0

現在、Tabhostを使用して3つのタブを作成し、RelativeLayoutを使用して最初のタブを作成してListViewを作成する単純なAndroidアプリケーションで作業していますが、ListViewが表示されないため、ListViewの背景色(白)を設定しようとしました。 ListViewは表示されていませんが、同じ結果が得られるので、Androidのタブバーでリストビューを設定する方法を教えてください。

前もって感謝します

私はこれを試しました

<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
  android:id="@+id/tabhost"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">

  <RelativeLayout
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <TabWidget android:id="@android:id/tabs"
      android:layout_width="fill_parent"
      android:layout_alignParentBottom = "true"
      android:layout_height="wrap_content"
     />

    <FrameLayout android:id="@android:id/tabcontent"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent">




    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tab1"

    android:layout_width="fill_parent"
    android:layout_height="200dip" >

    <ListView
        android:id="@+id/edittext01"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:background="#ffff"
        android:paddingTop="10px" />

</RelativeLayout>
4

1 に答える 1

0

実際には、上記の必要に応じてタブに従って ListView の位置を指定する必要があります。その後、必要に応じてandroid:layout_above="id_of_FrameLayout_containing_ListView "リストを表示する RelativeLayout プロパティを使用します。

また、ListView 内のコンテンツについては、追加した項目が正しく追加されていることを確認し、各リスト項目の描画に AdapterClass を使用している場合..

この説明があなたに役立つことを願っています...

于 2012-07-20T13:24:28.947 に答える