2011-10-24 11 views
0

私は、相対レイアウトを使用してボタンベースのメニューを作成しようとしています。私は親に合わせてリサイズ私はすでに持っていた3つのボタンの下にもう一つのボタンを追加しようとしましたが、代わりにボタンのボタンが画面から外れる

android:below="" 
android:above="" 
android:toLeftOf="" 
android:toRightOf="" 

コマンドに

を使用して、グリッドの形成にそれらを配置しようとしています代わりに4番目のボタンが画面の端より下に落ちます。小さな画面でボタンが見えないようにしたくないので、これを回避する方法がありますか?ここに私のレイアウトです

<RelativeLayout android:id="@+id/level1layout" 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:layout_weight="1" 
      android:layout_gravity="center_horizontal"> 

<Button android:id="@+id/OneLevel1Button" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:layout_marginRight="10dp" 
android:layout_marginLeft="10dp" 
android:layout_marginBottom="10dp" 
android:layout_marginTop="10dp" 
android:text="1" 
android:textSize="25dp" 
android:background="@drawable/warpbutton" 
android:visibility="gone"/> 

    <Button android:id="@+id/OneLevel2Button" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:layout_marginRight="10dp" 
android:layout_marginLeft="10dp" 
android:layout_marginBottom="10dp" 
android:layout_marginTop="10dp" 
android:layout_below="@id/OneLevel1Button" 
android:text="2" 
android:textSize="25dp" 
android:background="@drawable/warpbutton" 
android:visibility="gone"/> 

<Button android:id="@+id/OneLevel3Button" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:layout_marginRight="10dp" 
android:layout_marginLeft="10dp" 
android:layout_marginBottom="10dp" 
android:layout_marginTop="10dp" 
android:layout_below="@id/OneLevel2Button" 
android:text="3" 
android:textSize="25dp" 
android:background="@drawable/warpbutton" 
android:visibility="gone"/> 

<Button android:id="@+id/OneLevel4Button" 
android:layout_height="wrap_content" 
android:layout_width="wrap_content" 
android:layout_marginRight="10dp" 
android:layout_marginLeft="10dp" 
android:layout_marginBottom="10dp" 
android:layout_marginTop="10dp" 
android:layout_below="@id/OneLevel3Button" 
android:text="4" 
android:textSize="25dp" 
android:background="@drawable/warpbutton" 
android:visibility="gone"/> 

</RelativeLayout> 

視界は、起動時にメニューシステムのより深く隠されているので、デフォルトでは消されるように設定されています。

答えて

1

GridLayoutの使用を検討しましたか? http://developer.android.com/reference/android/widget/GridLayout.html

OPの提案では、GridViewcustom ButtonAdapterを作成する非常に役立つサイトです。

+0

私はその可視性を簡単に設定でき、複数のアクティビティを同じアクティビティで実行することはできますか?ああ、ここで使われている画像(http://developer.android.com/resources/tutorials/views/hello-gridview.html)をボタンで置き換えることはできますか? – Jack

+0

私はここでバックペダルをして、私が提供しようとしていた元のリンクを提供するつもりです - http://developer.android.com/guide/tutorials/views/hello-gridview.html あなたは、あなたが達成しようとしているもののアップ? –

+0

本当に言いたくないのは、怒っている鳥のレベル選択メニューのようなものだと思います。小さい番号の四角形がグリッドレイアウトに表示されます。 – Jack

関連する問題