2011-12-15 11 views
0

私は以下のようなものを作りたいと思います。しかし、なんらかの理由で、ボタンは見えません。誰もが親切に手伝ってくれるアンドロイドのレイアウトを持つ見えない要素

-------------------- 
txt1   txt2 
-------------------- 
|     | 
|     | 
|     | 
|  txtview1  | 
|     | 
|     | 
|     | 
-------------------- 
|btn1|  |btn2| 
-------------------- 

レイアウトコード:あなたはRelativeLayoutを使用する場合の位置は、あなたの要素の属性を使用する必要が

     <?xml version="1.0" encoding="utf-8"?> 

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

       <TextView 
        android:id="@+id/txt1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"    
        android:text="Network Status:  "/> 

       <TextView 
        android:id="@+id/txt2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="updating..." 
        android:layout_toRightOf="@+id/txt1"/> 

       <ScrollView 
        android:id="@+id/sv1" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_below="@id/txt1"> 

        <TextView 
         android:id="@+id/txt3" 
         android:layout_width="fill_parent" 
         android:layout_height="fill_parent" 
         android:text="Log"/> 

       </ScrollView> 

       <Button 
        android:id="@+id/btn1" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Start" 
        android:layout_below="@+id/sv1"/> 

       <Button 
        android:id="@+id/btn2" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:text="Stop" 
        android:layout_toRightOf="@+id/btn1" 
        android:layout_below="@+id/sv1"/> 


      </RelativeLayout> 
+0

あなたのScrollViewの周囲としてLinearLayoutを使用しようとしています... – WarrenFaith

答えて

2
のようなオプション

問題は、ScrollViewが残りのスペースを埋めることです。 fill_parent属性を使用できますが、ScrollViewはボタンの上にの上にでなければなりません。したがって、ScrollViewでは、layout_aboveをボタンの1つに設定します。

+0

ボタンからlayout_belowを削除していました。それは... thats it ...そして 'alignParentBottom =" true "' ..使用しました。あなたの説明は理にかなっています。ありがとう – Ahsan

1

があるでしょうandroid:layout_alignParentTop="true"android:layout_below="@id/yourelement

+0

'android:layout_alignParentTop =" true "'と入力すると、ボタンが表示されますが、それらは上部にあります。私が 'android:layout_alignParentBottom =" true "'を使用すると、ボタンは表示されません! – Ahsan

+0

'fill_parent'に設定されているスクロールビューは、それを行うものです。あなたのスクロールビューの高さが "fill_parent"に設定されているので、それはありますか? – CQM

+0

スクロールビューの高さにサイズを設定してみてください。 ボタンはそこにありますが、スクロールビューの下にあると思います – skeryl

関連する問題