2012-01-01 19 views
1

画面を2つの領域に分割しようとしています。左側はImageView、右側はScrolViewです。私は間違って何をやっているFrameLayoutとScrollViewを使用したAndroidでのレイアウトの問題

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    > 
    <FrameLayout 
      android:id="@+id/scene_view" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_gravity="left" 
      > 
    </FrameLayout> 
    <ScrollView 
      android:layout_height="fill_parent" 
      android:layout_width="@dimen/scrollmenu_width" 
      android:layout_gravity="right" 
      > 
     <LinearLayout 
       android:id="@+id/scrollmenu" 
       android:layout_height="fill_parent" 
       android:orientation="vertical" 
       android:layout_width="fill_parent" 
       > 
     </LinearLayout> 
    </ScrollView> 
</FrameLayout> 

:レイアウトのxmlファイルは次のようになりますので、私は、ImageViewとプログラム的ScrollViewの内容を追加していますか?右にScrollViewが表示されていますが、画面の左側に配置されたImageView(画面に対して)が中央に表示されているためです。画像の解像度が画面の解像度を超えて黒色になる

答えて

2

この問題を解決するには、LinearLayoutweightのパラメータを使用する必要があります。

あなたのスニペットを編集して、どのように使用するべきかを知りました。私はそれが役に立てば幸い

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

    <FrameLayout 
     android:id="@+id/scene_view" 
     android:layout_width="0dp" 
     android:layout_height="fill_parent" 
     android:layout_gravity="left" 
     android:layout_weight=1> 
    </FrameLayout> 
    <ScrollView 
     android:layout_height="fill_parent" 
     android:layout_width="0dp" 
     android:layout_weight=1 
     android:layout_gravity="right"> 
     <LinearLayout 
      android:id="@+id/scrollmenu" 
      android:layout_height="fill_parent" 
      android:orientation="vertical" 
      android:layout_width="fill_parent"> 
     </LinearLayout> 
    </ScrollView> 
</FrameLayout> 

..

+1

ああ、私は、私は、Androidに新たなんだばかりということ、それが可能だった知っていたし、それがこのような状況で私の心を交差しませんでした。ありがとうございます、解決策は働いていましたが、それはあなたが 'LinearLayout'にウェイトパラメータを書き込む方法ではありません。 – Romeo

+0

間違いをおかけして申し訳ありませんが、私は助けられてうれしいです。 –

+0

既に受け入れられました:)それは私が探していた解決策でした – Romeo

関連する問題