I have a ListView
. Each item should contain a bar chart which I create out of several TextView
-Objects.
Here is one for a single bar.
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp" >
<TextView
android:id="@+id/viewMon"
android:layout_width="25dp"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:background="#53933f" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/chart_mon"
android:textAlignment="center" />
</RelativeLayout>
In the getView
-Method of my Adapter, I try to calculate the height of this element and finally set it via
TextView dayView = (TextView) convertView.findViewById(R.id.viewMon);
dayView.setHeight(height);
The problem is that this seems to have no effect. The values should be correct and if I set the values as text I see them apperaing in the UI.
For me it seems that the system ignores layout parameters (getHeight
also returns 0) and uses the values form the xml-file at another place. How can I avoid this?