Tu je to, čo musím dosiahnuť, šírka môjho menu_divider by sa mala rovnať šírke môjho druhého LinearLayout (wrap_content).
Takže potrebujem získať šírku druhého LinearLayout a nastaviť ju na môj menu_divider. Ako to môžem urobiť? Vďaka.
<LinearLayout //second LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="174dp"
android:padding="8dip" >
<ImageView
android:id="@+id/itemImage"
android:layout_width="25dip"
android:layout_height="25dip"/>
<TextView
android:id="@+id/itemLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<View
android:id="@+id/menu_divider"
android:layout_width="174dp"
android:layout_height="1dp"
android:background="#96808080"
android:minWidth="174dp"
android:visibility="visible" />
odpovede:
0 pre odpoveď č. 1Mám to. Len som nastavil šírku na match_parent. Btw, toto rozloženie je pre PopUpWindow, takže match_parent na to odpovie.
0 pre odpoveď č. 2
skúste to...
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="174dp"
android:padding="8dip" >
<ImageView
android:id="@+id/itemImage"
android:layout_width="25dip"
android:layout_height="25dip"/>
<TextView
android:id="@+id/itemLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hwlloo nanfkjfouiofr dashjfkhal sdhf"/>
</LinearLayout>
<View
android:id="@+id/menu_divider"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ff0000"
android:visibility="visible" />
</LinearLayout>