0

Iは、次のレイアウトを有する:ボタンの背景を隠すボタンのテキスト。どうして?

<?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="@drawable/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> 

ボタンID button2android:id="@+id/button2")とは、エミュレータおよびマイルストーンIIのテキスト罰金を示しています。

しかし、.apkをMotorola Defyに挿入すると、ボタンの画像背景がテキストを隠す(「はい、できます!」)。背景を表示しないと(android:background="@drawable/funcoes_1"という行を削除しても)、ボタンのテキストが正しく表示されるので、私はそれを確信しています。

ボタンの背景イメージがモトローラのDefyのようなデバイスでテキストを隠している理由について誰かが知りませんか?

ありがとうございます!

+0

あなたのレイアウトコードはすべて間違っています。あなたはあなたのR.javaファイルのidをすでに定義しているので、 'android:layout_alignRight = @ + id/blah'を実行するべきではありません。 – hwrdprkns

+1

私は問題を修正しました。何らかの理由で、Motorola Defyのテキストのデフォルトの色が白でした。そして、私の背景も白であると、私はそのテキストを見ることができませんでした。ですから、私がする必要があったのは、テキストカラーを黒に設定することでした(#000000)。 –

答えて

0
android:layout_alignRight="@+id/button2" 
android:layout_alignLeft="@+id/button2" 
android:layout_below="@+id/button2" 

これらは、すべて「true」または「false」に設定する必要があります。これらのプロパティは、RelativeLayoutでメンバーの「相対的な」重力/アライメントを決定するために使用されます。

アンドロイド:id = "@ + button2"を一度宣言すれば十分です。

このデバイスで動作しないデバイスには、このエラーを許容しない古いバージョンまたはAndroidバージョンのAndroidがある可能性があります。

これが役に立った。