2011-12-21 5 views
0

私は本当に長い間欠席した後にAndroidに戻ってきています。私はすべてを忘れてしまいました。私はビルドにこのようなUIたいどのレイアウトを選択すればよいですか?

:アクション実行ボタンが代わりにアクションをしながら

enter image description here

ボタンアイテム1とアイテム2は、別のページへの移動を誘発します。広告は画面の下部にドッキングする必要があります。

このUIを実現するためにどのレイアウトを選択する必要がありますか? Android 2.2をターゲットにしています(問題がある場合)。

+0

滞在されますが、それは非現実的です。 – AngryHacker

+0

rahulごとに相対レイアウト –

答えて

4

私は相対レイアウトに行くと信じています。これは助けになるかもしれませんが、あなたは少し物事を改造したいかもしれません。

<?xml version="1.0" encoding="utf-8"?> 
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/relativeLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="42dp" 
      android:text="@string/item1" /> 

     <Button 
      android:id="@+id/button2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignLeft="@+id/button1" 
      android:layout_below="@+id/button1" 
      android:layout_marginTop="48dp" 
      android:text="@string/item2" /> 

     <Button 
      android:id="@+id/button4" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:text="@string/ad_goes_here" /> 

     <Button 
      android:id="@+id/button3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@+id/button2" 
      android:layout_centerHorizontal="true" 
      android:layout_marginTop="62dp" 
      android:text="@string/perform_action" /> 

    </RelativeLayout> 
+0

+1を試してみてください。正確なキャッチは+1ですが、自分自身がすべてを忘れていると言われているので、例を挙げて答えてください。 – ingsaurabh

+0

@ingsaurabh:yeah、edited .. :) – Ghost

+0

@AngryHacker:その広告の場所にあるボタンをクリックします。広告に適した正確な説明でいつでも変更できます。 – Ghost

2

あなたはandroid:orientation="vertical"LinearLayoutを使用することができます。しかし、あなたの望みのUIを達成することができる他の多くのレイアウトがあります。私はちょうどそれを垂直または水平に設定できるので、LinearLayoutに固執したいと思う。

+0

広告が下部にドッキングされていることをどのようにしたらいいですか? – AngryHacker

+1

たとえば、下部にアイテムをドッキングする必要がある場合は、Rahul氏のような相対レイアウトが役立ちます。あなたは 'android:layout_alignParentBottom'を使うことができます。この質問を見てください - http://stackoverflow.com/questions/2386866/how-to-align-views-at-the-bottom-of-the-screen – Hend

2

このレイアウトでは、リストビュー(単純)を使用し、リストビューの下にあるドラッグボタンを使用する必要がある相対レイアウトを続けることができます。そして下の場所であなたのadvertice SDKの面積はDr.nik @私はテーブルのレイアウトを試してみました

For more detail....

3
I think using Linear Layout is best 


<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 

<Button 
android:id="@+id/btn1" 
android:text="Item1" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" android:layout_gravity="center" 
/> 

<Button 
android:id="@+id/btn2" 
android:text="Item2" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" android:layout_gravity="center" 
/> 
<Button 
android:id="@+id/btn3" 
android:text="Perform Action" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" android:layout_gravity="center" 
/> 

<Button 
android:id="@+id/btn4" 
android:text="Ad Goes here" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" android:layout_gravity="center" 
/> 

</LinearLayout> 
関連する問題