Here is the XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/weightLossIndicator"
android:paddingLeft="15dp"
android:paddingRight="10dp"
android:orientation="vertical">
<TextView
android:id="@+id/weightValueTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:textColor="@android:color/black"
android:textSize="30sp"
android:textStyle="normal" />
<TextView
android:id="@+id/weightDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="20sp" />
<TextView
android:id="@+id/weightDifferenceTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:textColor="@android:color/black"
android:textSize="20sp" />
</LinearLayout>
<ImageView
android:id="@+id/weightLossIndicator"
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@color/change_green"/>
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:layout_below="@+id/weightLossIndicator"
android:layout_marginLeft="15dp"
android:background="@color/dark_blue" />
</RelativeLayout>
The view weightLossIndicator doesn't appear on device and simulator although it affects the other elements on the layout (their position). The background color is opaque and does appear in the Graphical Layout.
Update:
I tried to set a fixed height for the ImageView as 40 dp and guess what, it appears! Something wrong using match_parent but I don't know what. I also have to say, I am using this XML as ListView row layout.
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_alignParentBottom="true"
android:background="@color/dark_blue" />
<ImageView
android:id="@+id/weightLossIndicator"
android:layout_width="10dp"
android:layout_height="match_parent"
android:layout_above="@+id/separator"
android:layout_alignParentRight="true"
android:background="@color/change_green" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/separator"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_toLeftOf="@+id/weightLossIndicator"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="10dp" >
<TextView
android:id="@+id/weightValueTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="10dp"
android:textColor="@android:color/black"
android:textSize="30sp"
android:textStyle="normal" />
<TextView
android:id="@+id/weightDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="20sp" />
<TextView
android:id="@+id/weightDifferenceTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="10dp"
android:textColor="@android:color/black"
android:textSize="20sp" />
</LinearLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With