Reputation: 1177
I am trying to make a custom listView item with an image button and two textviews. The textview should be on the right as I am getting on the image below(android studio)
but I am getting this instead
The xml:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/account_item"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingRight="5dp"
android:longClickable="true"
android:clickable="true">
<ImageButton
android:layout_width="35dp"
android:layout_height="35dp"
android:id="@+id/logo"
android:elevation="3dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="2dp"
android:layout_marginRight="5dp"
android:layout_marginBottom="2dp"
android:layout_alignParentEnd="false"
android:layout_alignParentStart="true"
android:focusable="false"
android:focusableInTouchMode="false" />
<TextView
android:id="@+id/account_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:textSize="15sp"
android:textIsSelectable="false"
android:text="1234567890"
android:layout_alignTop="@+id/logo"
android:layout_alignParentEnd="true" />
<TextView
android:id="@+id/code"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:singleLine="true"
android:text="30-15-10"
android:textSize="10sp"
android:layout_below="@+id/account_number"
android:layout_alignStart="@+id/account_number" />
</RelativeLayout>
The parent layout is this:
<ListView
android:id="@+id/accounts_list"
android:layout_below="@id/accounts_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:headerDividersEnabled="true"
android:minHeight="40dp"
android:footerDividersEnabled="true"
android:paddingLeft="15dp"
android:drawSelectorOnTop="false"
android:dividerHeight="1dp" />
Halp?
Upvotes: 0
Views: 260
Reputation: 941
Try using
android:layout_alignParentRight="true"
instead of
android:layout_alignParentEnd="true"
Upvotes: 2