我是Android应用程序开发的初学者,我有一个问题,我找不到任何解决方案。我正在使用nexus 5的应用程序,它工作得很完美,布局之间没有空格,但是当我切换到nexus 4时,会发生这种情况(我使用颜色来分隔布局):
如果我切换到像素xl:
我能做什么,右边没有空格?(下面是发布的XML代码,以防你需要)。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
android:weightSum="1">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f00">
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="onClickDTB"
android:text="Convert to Binary"
android:textAlignment="center"
android:textAllCaps="true"
android:textSize="14sp"
android:textStyle="bold|italic" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0f0">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="98dp"
android:layout_weight="0.01"
android:fontFamily="serif-monospace"
android:text="Calculator"
android:textAlignment="textEnd"
android:textColor="@android:color/white"
android:textSize="35dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="#f0f"
android:orientation="horizontal">
<LinearLayout
android:layout_width="72.4dp"
android:layout_height="match_parent"
android:background="#FFA500"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="72.4dp"
android:layout_height="match_parent"
android:background="#000FFF"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="72.4dp"
android:layout_height="match_parent"
android:background="#8B0000"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="72.4dp"
android:layout_height="match_parent"
android:background="#800080"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="72.4dp"
android:layout_height="match_parent"
android:background="#2E8B57"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
答案 0 :(得分:0)
尝试以下代码
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#f00">
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:onClick="onClickDTB"
android:text="Convert to Binary"
android:textAlignment="center"
android:textAllCaps="true"
android:textSize="14sp"
android:textStyle="bold|italic" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#0f0">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="98dp"
android:layout_weight="0.01"
android:fontFamily="serif-monospace"
android:text="Calculator"
android:textAlignment="textEnd"
android:textColor="@android:color/white"
android:textSize="35dp"
android:textStyle="bold" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#f0f"
android:orientation="horizontal">
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#FFA500"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000FFF"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#8B0000"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#800080"
android:orientation="vertical">
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#2E8B57"
android:orientation="vertical">
</LinearLayout>
</LinearLayout>
答案 1 :(得分:0)
你必须像这样使用体重和体重总和
if(is_array($data)) {
$data = "({$id}.meta_value IS NULL OR {$id}.meta_value IN ('".implode("','",$data) ."'))";
}