ImageView inside LinearLayout does not show when "android:layout_weight" on LinearLayout -
here code
<linearlayout android:layout_width="wrap_content" android:orientation="horizontal" android:layout_weight="1" android:layout_height="wrap_content"> <radiobutton android:id="@+id/preference_question_optiontwo" android:layout_width="fill_parent" android:layout_height="wrap_content"/> <linearlayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> <textview android:layout_height="wrap_content" android:layout_width="wrap_content"/> </linearlayout> </linearlayout>
now here when apply android:layout_weight="1" on linearlayout image not appear.without property image displayed.
what want divide layout 2 parts. both parts containing same code above i.e radio button , besides image , text
update how want it
this getting output
the layout weight property elements within linear layout. should give each half of screen same weight , put them both within linear layout.
here's need:
<linearlayout android:layout_width="wrap_content" android:orientation="horizontal" android:layout_height="match_parent" android:layout_width="match_parent"> <!-- first half --> <linearlayout android:layout_width="wrap_content" android:orientation="horizontal" android:layout_weight="1" android:layout_height="wrap_content"> <radiobutton android:id="@+id/preference_question_optiontwo" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <linearlayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> <textview android:layout_height="wrap_content" android:layout_width="wrap_content"/> </linearlayout> </linearlayout> <!-- first half, same weight first half --> <linearlayout android:layout_width="wrap_content" android:orientation="horizontal" android:layout_weight="1" android:layout_height="wrap_content"> <radiobutton android:id="@id/preference_question_optiontwo" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <linearlayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:orientation="vertical"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_launcher" /> <textview android:layout_height="wrap_content" android:layout_width="wrap_content"/> </linearlayout> </linearlayout> </linearlayout>
Comments
Post a Comment