質問

してい LinearLayoutScrollView その android:layout_height="fill_parent", な拡大の高さ ScrollView.私のレイアウトのようになります:

level    layout    layout_width    layout_height
1    LinearLayout    fill_parent    fill_parent
2    LinearLayout    fill_parent    wrap_content
3    (some irrelevant stuff)
2    ScrollView      fill_parent    fill_parent <-- this expands full height
3    LinearLayout    fill_parent    fill_parent <-- this does not (has orientation=vertical)
(following stuff probably are irrelevant, but just to be sure:)
4    TextView        fill_parent    fill_parent
4    LinearLayout    fill_parent    wrap_content

参照:うに LinearLayout な拡大の高さ ScrollView でEclipse Android Layout Editor, ばかりの選択 ScrollView の概要パネルで強調され、赤いボーダー埋める"の画面を下にしたものを選択し LinearLayout その強い拡大のチェックを入れます。方法を教えてくださいすることができるようになります。

の効果を監督-選手コメンは一部のテキストやボタンの下での LinearLayout レベル4があります。テキストできるのに十分な大きさで必要なスクロールバーの場合たいのユーザはスクロールダウンするためのボタンを押します。場合は、テキストがないのに十分に大きいためにスクロールバーをしたいの LinearLayout を含むボタンの下の画面になります。

最初は思わないんでポストをXMLでは、通常て大きなチャンクのコードは反対の立場をとりました。しかし、そうです必要もあるのではないでしょう、このレイアウト。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:id="@+id/video_layout"
        android:focusable="true"
        style="@style/VideoLayout">
        <FrameLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:foreground="@android:drawable/ic_media_play"
            android:foregroundGravity="center">
            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:id="@+id/video_thumb"
                android:padding="5dip"
                android:background="#454545"/>
        </FrameLayout>
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:focusable="true"
            style="@style/VideoTitle"
            android:id="@+id/video_title"
            android:layout_gravity="center"
            android:layout_weight="1"/>
    </LinearLayout>
    <ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
        <!-- this ScrollView expands the full height of the screen.
             However, the next LinearLayout does not expand the full height of the ScrollView -->
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_weight="1"
            android:layout_gravity="fill"
            android:orientation="vertical"
            android:id="@+id/info_layout">
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:id="@+id/info_body"
                style="@style/InfoText"/>
            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                style="@android:style/ButtonBar">
                    <Button
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_weight="1"
                        android:text="@string/button_readmore"
                        android:id="@+id/btn_read_more"/>
            </LinearLayout>
        </LinearLayout>
    </ScrollView>
</LinearLayout>

のっぽ android:layout_gravity="bottom" の問題 LinearLayout, のボタンにこだわり、画面下部のでしょう。でも、テキストにこだわり画面の下部になってしまう。

更新: 傷をつける android:layout_gravity="bottom" この ScrollView できない、スクロール.その他の考えになりますか。

役に立ちましたか?

解決

解決方法を発見したら自分が終了。この問題はないの LinearLayout, ですが、 ScrollView (そうになっていることなどを踏まえると、を ScrollView の拡大が LinearLayout ん).

この溶液を使用 android:fillViewport="true"ScrollView.

他のヒント

私が知っているこの記事では、それは時々、キーボードの上のEditTextを起動していないためandroid:fillViewport="true"を使用したくない人のために、非常に古いです。 それは目的を解決するための代わりのLinearLayoutの相対的なレイアウトを使用します。

あなたのレイアウトXMLを提供することはできますか?そうすることで、人々が最小限の労力で問題を再作成できるようになります。

あなたが設定する必要があります。

android:layout_weight="1"
あなたが拡大したい項目の

私は、動的にこれを取得するために使用されてきました。私はのLinearLayoutを持っており、この内の子としてScrollViewを使用しました。その後、私は再びのLinearLayoutを取ると、これまでにuはこれのLinearLayoutにしたいし、こののLinearLayoutがScrollViewに追加し、最終的にはのLinearLayoutにこのScrollViewを追加見るものを追加します。そして、uはウルScrollViewのスクロールを取得することができますし、何も見えに残っていないでしょう。

のLinearLayout(親) - ScrollView(LinerLayoutの子) - のLinearLayout(ScrollViewの子は) - uが好きなスピナーなど、ボタン、こちらのTextViewを追加します。そして、ScrollViewにこのLinearLyoutを追加します。 BcozはLinearLyout.IfにScrollView適用し、最後のアドオンこのScrollViewのための子供ひとりは、領域が、その後uはScrollViewの中にスクロールを取得します画面サイズから超過で定義されます。

私の場合は、

を与えられていません
  

のLinearLayout(ScrollView・チャイルド)の方位

(のLinearLayoutの場合)あなたのScrollViewの子に設定されている。

はだから、デフォルトでは、水平かかりますが、scrollviewのscrolsは垂直方向に、そうかどうかを確認してください「方向= 『縦』アンドロイド」。

  

これは私のケースだったことは、それが

誰かを助けたいと考えています

ソリューションを使用することです。

android:fillViewport="true"

上のスクロールビューをさらに使用することにしてみてください。

"wrap_content"

として

"fill_parent"代わりに"fill_parent"

は廃止されます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top