1

レイアウトの背景全体を覆うグラデーションがあります。ただし、ソフトウェア キーボードを閉じると、グラデーションが最大の高さにサイズ変更されるまでに約 1 秒かかります。これにより、下の図に示す白い背景が生成されます。

私は何かをすることを考えました

android:windowSoftInputMode="adjustPan"

ただし、リスト ビューの大部分がキーボードの下に隠れてしまうため、これは悪い習慣です。勾配:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle"
    android:useLevel="false" >
    <gradient
        android:startColor="#0d2d70"
        android:endColor="#007dbc"
        android:useLevel="false"
        android:type="linear"
        android:angle="45" />
</shape>

レイアウト:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/gradient"
    android:padding="20dp" >

    <!-- input field is here -->

    <ListView
        android:id="@android:id/list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/input_licence"
        android:divider="#FFFFFF"
        android:dividerHeight="1dp"
        android:padding="5dp"
        android:scrollbarStyle="outsideOverlay" >
    </ListView>


</RelativeLayout>

空白を防ぐ方法はありますか?

ここに画像の説明を入力

4

2 に答える 2

1

問題を解決しました。すべてのアクティビティにバックグラウンド ドローアブルを設定する代わりに、styles.xml で次のように設定します。

<style name="AppTheme" parent="AppBaseTheme">
    <item name="android:windowBackground">@drawable/gradient</item>
</style>

空白が消えます。

于 2013-10-23T17:23:40.100 に答える
0

キーボードが終了した後、ビューが無効にならないようです。実際の問題についてはわかりませんが。コードを使用してビューを手動で無効にすることをお勧めします。お気に入り、

container.invalidate();

http://developer.android.com/reference/android/view/View.html#invalidate()

于 2013-10-23T14:44:37.343 に答える