cannot change size of TextView inside FrameLayout

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

cannot change size of TextView inside FrameLayout

Postby davekong » Mon Nov 03, 2008 7:37 am

I have a layout file where part of it is below. 2 TextViews nested inside the same FrameLayout so that the 1st one (being lower in the Z-order) shows up behind the text (which has transparent background).

<FrameLayout android:id="@+id/upper_status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="2dp">
<TextView android:id="@+id/player_hp"
android:layout_width="5dp"
android:layout_height="fill_parent"
android:background="#ff0000"/>
<TextView android:id="@+id/player_name"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#00000000"
android:gravity="center"
android:text="@string/player_name"/>
</FrameLayout>

My goal is to change the width of the first TextView so that it represents the HP of a player. But no matter what I do programatically (e.g. setWidth(x), measure(), requestLayout(), etc.) nothing seems to change the size of the TextView.

Can someone help? I must be missing something stupid and the documentation doesn't point me anywhere.

Thanks!
davekong
Once Poster
Once Poster
 
Posts: 1
Joined: Mon Nov 03, 2008 7:35 am

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests