2011-12-03 8 views
1

このコードを使用しています。相対レイアウトでボタンを配置しない

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:text="Button" /> 

</RelativeLayout> 

、これは540x960とエミュレータで動作していないいくつかの理由があります。エミュレータの中央にボタンが表示されます。

私のdroid2では正しく動作します。

enter image description here

左の写真は、あなたがあなたのTextViewにアンカーポイントを設定する必要がHTC sensationXeエミュレータで

+0

エミュレータのOSのバージョンはどれですか?また、TextViewを何かに固定する必要があります。 –

+1

私は既に私の質問を更新して、いくつかの画像をアップロードするので、問題がわかります – Yayo28

答えて

0

を働いているか、それは私のドロイド2携帯電話でどのように動作するかを示し、右側のショー..ボタンの左側または右側にテキストビューを配置しようとすると、問題は消えます。

0

相対レイアウトでは、方向属性が機能しません。私はすでに問題の答えを見つけることが

<TextView 
    android:id="@+id/helloid" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="@string/hello" /> 

<Button 
    android:id="@+id/button1" 
    android:layout_below="@id/helloid" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:text="Button" /> 
+0

この問題は、私はすでに問題についての画像をアップロードしています。 – Yayo28

1

次試してみてください。私は今、私はマニフェスト

<uses-sdk android:minSdkVersion="3" 
    android:targetSdkVersion="4" /> 

にこれを追加し、私は1.6

今では

0

編集してXMLでなければならな場所にあるがAndroidにコンパイルし、anddroid 1.5として私のアプリをコンパイルしましたこれによって、それは動作します。

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/hello" /> 

    <Button 
     android:id="@+id/button1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentLeft="true" 
     android:gravity="bottom" 
     android:text="Button" /> 

</RelativeLayout> 
関連する問題