android - TextView wrap causes adjacent ImageView to disappear -
i'm puzzled simple-looking issue can't figure out. got display button includes image (flag), text, , image (caret). these 3 in layout container, assigned weight since there's button next it. here's how layout container looks:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/countryselect" android:orientation="horizontal" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".88" android:gravity="center_vertical" android:clickable="true" android:onclick="clickhandler" > <imageview android:id="@+id/countryflag" android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingright="8dp" android:src="@drawable/flag_argentina" /> <textview android:id="@+id/countryname" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="@string/app_title" android:textstyle="bold" android:textcolor="#4898c0" /> <imageview android:layout_width="wrap_content" android:layout_height="fill_parent" android:paddingleft="4dp" android:src="@drawable/corner" /> </linearlayout>
the whole thing works fine if text in textview fits in 1 line. if doesn't, ie, if text wraps 2 lines, caret image disappears (while flag displays vertically centered should). flag image , caret have same pixel height. note other button (not shown in above code) that's right of linearlayout still displays fine, issue not caret image pushed off right side of screen.
any idea why may happening/what can keep caret image visible? appreciate help!
as text extends make 2md image out of screen fix width of textview using wieght
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/countryselect" android:orientation="horizontal" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight=".88" android:gravity="center_vertical" android:clickable="true" android:onclick="clickhandler" android:weightsum="1"> <imageview android:id="@+id/countryflag" android:layout_width="0dp" android:layout_height="fill_parent" android:paddingright="8dp" android:src="@drawable/launcher_icon" android:layout_weight=".3" /> <textview android:id="@+id/countryname" android:layout_width="0dp" android:layout_height="fill_parent" android:text="@string/app_title" android:textstyle="bold" android:textcolor="#4898c0" android:layout_weight=".4"/> <imageview android:layout_width="0dp" android:layout_height="fill_parent" android:paddingleft="4dp" android:src="@drawable/launcher_icon" android:layout_weight=".3"/> </linearlayout>
Comments
Post a Comment