我有這個序列的佈局:imageview,ratingbar和tabhost(包含用戶和信息的審查)。對於用戶的tabhost評論,我使用自定義的listview,並且我成功地顯示了用戶的所有評論。但我的問題,你可以看到下面的圖片(列表視圖身高只有1項包裹的內容,如果我把它的滾動,它可以加載所有數據)ListView只顯示1項
而且我想使這個佈局(它顯示多個項目,作爲父母的身高)
這裏我的佈局XML
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- HEADER -->
<LinearLayout
android:id="@+id/header"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_centerHorizontal="true"
android:background="#dcdcdc"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:layout_alignParentTop="true">
<ImageView
android:id="@+id/ivplacedetail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|center_horizontal"
android:src="@drawable/search"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name" />
<RatingBar
android:id="@+id/ratingBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<!-- FOOTER -->
<LinearLayout
android:id="@+id/footer"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
android:background="#a9d633">
<Button
android:id="@+id/btnhome"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:text="Home"
android:background="@layout/round_border"/>
<Button
android:id="@+id/btnbookmark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:text="Bookmark"
android:background="@layout/round_border"/>
<Button
android:id="@+id/btnnearby"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:layout_marginBottom="2dp"
android:text="Nearby"
android:background="@layout/round_border"/>
</LinearLayout>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@+id/footer"
android:layout_below="@+id/header">
<TabHost
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
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_height="fill_parent" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout>
</TabHost>
</ScrollView>
</RelativeLayout>
我LIS tview自定義佈局在這裏
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imguser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="1dp"
android:src="@drawable/atmicon"
android:scaleType="fitCenter">
</ImageView>
<TextView
android:id="@+id/lbluser"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:layout_marginTop="3dp"
android:layout_marginBottom="1dp"
android:layout_toRightOf="@+id/imguser"
android:textColor="#4068ec"
android:text="Nama User">
</TextView>
<TextView
android:id="@+id/lblwaktu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/imguser"
android:layout_below="@+id/lbluser"
android:layout_marginLeft="5dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
android:text="Waktu Review">
</TextView>
<TextView
android:id="@+id/lblreview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/imguser"
android:layout_below="@+id/lblwaktu"
android:layout_marginLeft="5dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
android:text="isi Review">
</TextView>
</RelativeLayout>
我的ListView佈局
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/lvreview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
有人可以幫我解決我的佈局?
當您將其登錄到適配器中時,您會得到10或1個什麼值?問題可能是該適配器在循環完成之前填充 – Elltz 2014-10-18 18:04:39
已顯示所有數據(查看),但問題現在它的高度僅僅是1個數據(查看),鏈接顯示 – Kaizternn 2014-10-18 19:11:20