0
アイテムのリストを表示するページがあります。リストの各行には3つの列があり、何らかの理由でリストにある項目が正しく整列していません。以下 は私のコードです:Android:CustomListAdapterの列が正しく整列しない
カスタムアダプタ: 以下
<TextView
android:id="@+id/tvCategoryName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:layout_weight="0.90"
android:textAlignment="textStart"/>
<TextView
android:id="@+id/tvWeight"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weight"
android:layout_weight="0.05"
android:textAlignment="center"/>
<TextView
android:id="@+id/tvAverage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Average"
android:layout_weight="0.05"
android:textAlignment="center"/>
</LinearLayout>
それが表示されますかのスクリーンショットです:私はCategories
、Weight
、およびAverage
すべての3つの列になりたい
centered
テキストアライメントの形式のような素敵な表で表示されます。
「カテゴリ名」が長すぎたり短すぎたりすると、それでも機能しません。 –
はい、layout_weightを使用している場合は、layout_widthを0dp –
に設定する必要があります。どうもありがとうございました :) –