开发者

CheckedTextView layout issue

I've a List view layout withCheckedTextView, code follows

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="?android:attr/listPreferredItemHeight"
    android:paddingLeft="5dip" android:paddingRight="5dip"
    android:paddingTop="5dip" android:paddingBottom="5dip"
    android:fastScrollEnabled="true"
    >
    <LinearLayout android:orientation="horizontal"
        android:padding="0dip" android:layout_width="fill_parent" 
        android:layout_weight="1" android:layout_height="wrap_content">
        <CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" 
             android:id="@+id/listCheckboxview" 
             android:layout_width="fill_parent" 
             android:layout_height="wrap_content" 
             android:layout_weight="1" android:gravity="center|left" 
             android:textColor="#0075AB"  android:textStyle="bold"  android:te开发者_开发技巧xtSize="14dip"
             android:checkMark="?android:attr/listChoiceIndicatorMultiple" 
             android:paddingLeft="6dip" 
             android:paddingRight="6dip" 
             android:clickable="true"
             android:focusable="true"
             android:text="" 
             /> 
    </LinearLayout>
    <LinearLayout android:orientation="horizontal"
        android:padding="0dip" android:layout_width="fill_parent" 
        android:layout_weight="1" android:layout_height="wrap_content">
        <TextView android:id="@+id/customerDueAmount" android:paddingLeft="10dip"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_weight="1" android:gravity="left" 
            android:textColor="#0075AB"  android:textStyle="bold"  android:textSize="14dip"
            android:text="112233" 
        />
        <TextView android:id="@+id/customerRevievedAmount" android:paddingLeft="10dip"
            android:layout_width="wrap_content" android:layout_height="wrap_content"
            android:layout_weight="1" android:gravity="left" 
            android:textColor="#0075AB"  android:textStyle="bold"  android:textSize="14dip"
            android:text="444555" 
        />
    </LinearLayout>
</LinearLayout>

Above layout results the screen

CheckedTextView layout issue

I heed to make the texts 112233 and 444555 appear below the customer text and checkbox, How can i do that?


Try to use RelativeLayout and methods like layout_below="id" and etc.

  1. Set your Customer text to layout_alignParentLeft="true"
  2. Set your CheckBox to layout_toRightOf="Customer text ID"
  3. Set the 112233 text to layout_below="CheckBox ID"
  4. Set your 445566 text to layout_toRightOf="112233 ID"

You can find more about it here : android layout tutorial


Set android:orientation="vertical" to your root layout.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜