I am trying to build a custom view for the ListView rows. Below is what my
row looks like
Img | Text 1
|------------Text | Text 2
Below is my layout that I am using to generate row view
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="wrap_content"
>
<RelativeLayout
android:id="@+id/icon_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_margin="10dp"
android:padding="10dp" >
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_marginBottom="10dp"
android:contentDescription="@string/app_name"/>
<TextView
android:id="@+id/status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/icon"
android:layout_centerHorizontal="true"
android:text="STATUS" /></RelativeLayout>
<View
android:id="@+id/ver_divider"
android:layout_width="2dp"
android:layout_height="fill_parent"
android:layout_alignBottom="@id/icon_status"
android:layout_alignTop="@id/icon_status"
android:layout_toRightOf="@id/icon_status"
android:background="@android:color/black" />
<View
android:id="@+id/hor_divider"
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_centerVertical="true"
android:layout_marginRight="10dp"
android:layout_toRightOf="@id/ver_divider"
android:background="@android:color/black" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignBottom="@id/icon_status"
android:layout_alignTop="@id/icon_status"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_toRightOf="@id/ver_divider"
android:background="#99FF0000"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="Test ME" />
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:gravity="center"
android:text="Test ME" /></LinearLayout></RelativeLayout>
List view is pretty simple no customisation.
Text 1 and Text 2 comes at equal distance from the horizontal separator.
While I tried to set Text2 below the separator with layout_below it doesn't
work. In the above layout I tried to create a linearlayot with full hight
as view and then setting two textviews of same height using weight this
also doesn't work.
While the same code works fine on android 5.0 it fails on android 4.4.4 or
below.
Any help is highly appreciated.. Not sure what should I do to make it work
on the android 4.x.x
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.