我有一个LinearLayout
里面另一个LinearLayout
。我遇到的问题是ToggleButton
在第二个中不可见LinearLayout
..这是我的完整 UI。我也想知道这种布局设计是否有效。我知道我可以使用TableLayout
,但是我在一条线上安装 3 个组件时遇到问题
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dip" >
<TextView
android:id="@+id/supplierNameTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/supplierNameTV"
android:textColor="#FFFFFF"
android:layout_gravity="right"/>
<LinearLayout android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<AutoCompleteTextView
android:id="@+id/supplierName_CB"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<ToggleButton
android:id="@+id/toggleButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:checked="false"
android:text="ToggleButton" />
</LinearLayout>
<TextView
android:id="@+id/prodNameTV"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/prodNameTV"
android:textColor="#FFFFFF"
android:layout_gravity="right"
android:layout_marginBottom="5dip"
android:layout_marginTop="5dip"/>
<AutoCompleteTextView
android:id="@+id/prodName_CB"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/add_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/addproduct_button"
android:textColor="#372c24" />
<ListView
android:id="@+id/listview"
android:layout_height="wrap_content"
android:layout_width="match_parent">
</ListView>
</LinearLayout>