Androidのlayout_weight属性を効果的に使用する方法がわかりません。3 つの textView を持つカスタム listView を作成しようとしています。プライマリ textView は左上にあり、次に右上にテキスト ビューがあり、次にプライマリ textView の下にある 3 番目のビューがあります。プライマリと右上の 2 つを水平軸に配置したいのですが、プライマリ textView が幅の約 70% を占めるようにし、他の textView が残りの 30% を占めるようにします。プライマリと右の textView にどのような重みを割り当てても、プライマリの textView は常に大きくなり、右のデータ textView があまりにも薄くなります。
私のコード:
<LinearLayout android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="5dip"
android:id="@+id/Llayout">
<!-- Title-->
<TextView
android:id="@+id/primaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Loading some tadglkj dgjg sadlgkj dgksgj sgj sdgk"
android:textColor="#040404"
android:typeface="sans"
android:textSize="18dip"
android:textStyle="bold"
android:paddingTop="0dp"
android:background="#888"
android:layout_weight="4"/>
<!-- Right Data -->
<TextView
android:id="@+id/rightData"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="10"
android:layout_marginRight="5dip"
android:textSize="12dip"
android:textColor="#B53021"
android:textStyle="bold"
android:background="#bada55"
android:text="1.3 mi"/>
</LinearLayout>
<!-- Secondary title -->
<TextView
android:id="@+id/secondaryTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#343434"
android:textSize="12dip"
android:layout_marginTop="1dip"
android:text="hello this is some other data"/>