Button background hidding button text. Why?
I have the following layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget30"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/v_fundo"
>
<ImageView
android:id="@+id/imageView1"
android:layout_height="wrap_content"
android:src="@drawabl开发者_运维技巧e/v_titulo"
android:layout_width="wrap_content"
android:layout_alignParentLeft="true">
</ImageView>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout2" android:layout_width="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true">
<ImageView android:id="@+id/widget32" android:layout_height="wrap_content" android:layout_width="wrap_content" android:background="@drawable/v_personagem"> </ImageView>
<Button android:layout_height="wrap_content" android:background="@drawable/v_balao" android:layout_width="wrap_content" android:id="@+id/lastComicButton"></Button>
</RelativeLayout>
<ImageView android:src="@drawable/v_transparente" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/imageView2" android:layout_alignParentBottom="true"></ImageView>
<RelativeLayout android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/relativeLayout1" android:background="@drawable/funcoes_fundo" android:layout_above="@+id/imageView2" android:layout_alignLeft="@+id/imageView2" android:layout_alignRight="@+id/imageView2">
<Button android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_width="wrap_content"
android:id="@+id/button2"
android:text="Yes, we can!"
android:background="@drawable/funcoes_1">
</Button>
<Button android:layout_height="65dp"
android:layout_alignRight="@+id/button2"
android:layout_alignLeft="@+id/button2"
android:layout_width="250dp"
android:id="@+id/button1"
android:layout_below="@+id/button2"
android:background="@drawable/funcoes_2">
</Button>
</RelativeLayout>
The button with id button2
(android:id="@+id/button2"
) shows the text fine in the Emulator and on the Milestone II.
However, when I put the .apk
into the Motorola Defy, the image background of the button hides its text ("Yes, we can!"). I am sure of that because if I don't show the background (by deleting the line android:background="@drawable/funcoes_1"
), the text is shown fine in the button.
Does anybody have any clue on why the background image of the Button is hiding its text in some devices (like the Motorola Defy)?
Thank you in advance!
android:layout_alignRight="@+id/button2"
android:layout_alignLeft="@+id/button2"
android:layout_below="@+id/button2"
These should all be set to either "true" or "false". These properties are used to determine in a RelativeLayout the "relative" gravity/alignment of a member.
Declaring android:id="@+button2" once is enough.
What is likely happening is the device it doesn't work on has an older or different version of Android that is not tolerant of this error.
Hope this helped.
精彩评论