我有一個列表視圖與2個單選按鈕項目。當從佈局中膨脹時,即使有如下所示的大量空間,它也可以滾動。如屏幕截圖所示,我有2個單選按鈕。 1.距離 2.評級Android - 列表視圖與單選單選按鈕
但「評級」單選按鈕不可見,我必須滾動才能看到它。這是爲什麼發生。我試圖設置佈局高度來包裝內容,填充父級和匹配父級。但是這並沒有解決問題。任何想法爲什麼發生這種情況?
我在這裏引用列表視圖:
ListView radio_list = (ListView) view.findViewById(R.id.RadioList);
radio_list.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_single_choice,
radio_list_items));
radio_list.setItemsCanFocus(true);
radio_list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
我的xml:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:paddingLeft="10dp"
android:text="SEARCH"
android:textColor="#FF3300"
android:textSize="20dp" >
</TextView>
</LinearLayout>
<RelativeLayout
android:id="@+id/searchTextLayout"
android:layout_width="match_parent"
android:layout_height="50dip"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="20dip"
android:layout_marginLeft="20dip"
android:layout_marginRight="20dip"
android:layout_marginTop="20dip"
android:orientation="horizontal" >
<ImageButton
android:id="@+id/searchTextButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:background="#685E5C"
android:contentDescription="Sample"
android:scaleType="fitCenter"
android:src="@drawable/abs__ic_search" />
<EditText
android:id="@+id/searchText"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_toRightOf="@id/searchTextButton"
android:background="@drawable/background_black_border_full"
android:padding="8dp"
android:textColor="@android:color/white" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:paddingLeft="10dp"
android:text="SORT BY"
android:textColor="#FF3300"
android:textSize="20dp" >
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ListView
android:id="@+id/RadioList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
</LinearLayout>
是行'的ListView radio_list =(ListView控件)view.findViewById(R.id.RadioList);''從的onCreate()'或別的地方?此外,這裏的「視圖」是什麼? – Barney 2013-02-28 11:45:31
它來自擴展SherlockFragment的我的SlidingFragment類的onCreateView。也「查看視圖= inflater.inflate(R.layout.list,容器,假);」 – 2013-02-28 11:48:52
我正在構建一個示例應用程序來實現滑動菜單。所以我會返回「視圖」到我的SlidingFragmentActivity來顯示滑動菜單。 – 2013-02-28 11:53:33