Issue
So I have a button on each row in my expandable list, and below is my XML layout file for the text view and button (which are supposed to be on the same line), but the text "Assign Badge" is too long and unless I make the text size smaller, it doesn't fit, with single line = true, it doesn't help because then it will not show half the text, without it, the text in the button will appear on two lines...is there a way to get it so the button could be wider? Thanks.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="55dip"
android:orientation="horizontal"
android:weightSum="1" >
<TextView
android:id="@+id/listItem"
android:layout_width="match_parent"
android:layout_height="35dp"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:layout_weight="0.2"
android:textSize="17dip"
android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft" />
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_weight="0.8"
android:textSize="8dp"
android:singleLine="true"
android:text="Assign Badge"
android:id="@+id/assign" />
</LinearLayout>
Solution
See if this helps,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="55dip"
android:orientation="horizontal" >
<TextView
android:id="@+id/listItem"
android:layout_width="0dp"
android:layout_height="35dp"
android:layout_weight="0.7"
android:focusable="false"
android:focusableInTouchMode="false"
android:gravity="center_vertical"
android:text="TEST"
android:paddingLeft="?android:attr/expandableListPreferredChildPaddingLeft"
android:textSize="17dip" />
<Button
android:id="@+id/assign"
style="?android:attr/buttonStyleSmall"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:focusable="false"
android:focusableInTouchMode="false"
android:singleLine="true"
android:text="Assign Badge"
android:textSize="8dp" />
</LinearLayout>
Answered By - Chitrang
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.