0
私はカスタムリストアダプタ内の1つのノードに1 ImageView
、2 TextViews
と1 Rating Bar
を表示したいが、私はここのコードは、カスタムリストのXMLコードで実行したときに、それをトリミング Here is the picture of listAndroid:カスタムリストビューを調整する方法は?
custom_list.xml
あなたのリストビュー項目のXML以下?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TableRow>
<ImageView
android:id="@+id/img"
android:layout_width="50dp"
android:layout_height="50dp"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Name"
android:id="@+id/tv_name"
android:layout_column="2" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:textAppearance="?android:attr/textAppearanceMedium"
android:id="@+id/tv_deal"
android:layout_column="2"
android:text="deals" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<RatingBar android:id="@+id/rb_rating"
android:layout_column="2" />
</TableRow>
「RelativeLayout」ではなく「TableLayout」を使用する理由は何ですか? ...それは問題がここにないようですが、リストビューを持っているレイアウトにあります – Selvin
相対レイアウトはカスタムレイアウトでこれと同じように機能しますか? – SFAH
はい、動作します。あなたのリストビューまたはRecyclerviewのレイアウトを投稿する –