私のスクロールビューには、編集テキストフィールドのいくつかをさらに含む線形レイアウトが含まれています。一番下の編集テキストフィールドをクリックすると、ソフトキーボードが表示されますが、問題は、その編集テキストフィールドをカバーしていることです。これは、Androidマニフェストファイルで宣言された私のアクティビティです。
<activity android:name="me.example.scrollview.LoginActivity" android:label="@string/title_activity_login" android:theme="@android:style/Theme.Black.NoTitleBar" android:windowSoftInputMode="stateHidden|adjustResize|adjustPan" > </activity>
これがこのアクティビティのlayout.xmlファイルです。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray"
tools:context=".LoginActivity" >
<ScrollView
android:id="@+id/login_sv_login_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="true"
android:background="@android:color/transparent" >
<LinearLayout
android:id="@+id/login_ll_container"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_marginTop="230dp"
android:layout_gravity="center_horizontal"
android:background="@android:color/transparent"
android:orientation="vertical" >
<EditText
android:id="@+id/txt_username"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_gravity="center_horizontal"
android:background="@drawable/rounded_edittext"
android:ems="10"
android:inputType="textEmailAddress"
android:maxLines="1"
android:singleLine="true" >
<requestFocus />
</EditText>
<EditText
android:id="@+id/txt_phone"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_edittext"
android:ems="10"
android:inputType="phone"
android:maxLines="1"
android:singleLine="true" />
<EditText
android:id="@+id/txt_password"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_edittext"
android:ems="10"
android:inputType="textPassword"
android:maxLines="1"
android:singleLine="true" />
<Button
android:id="@+id/btn_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginTop="10dp"
android:background="@drawable/ic_login"
android:text="" />
</LinearLayout>
</ScrollView>
私はアンドロイドプログラミングに非常に慣れていないので、今私を助けてください。この問題を修正できず、メインウィンドウのサイズを変更せずにスクロールビューをスクロールする方法が見つかりません。ソフトキーボードが表示されたときにスクロールビューでスクロールできるようにしたいだけです。よろしくお願いします。
以前に指摘した両方のソリューションが機能します。ただし、編集テキストがListViewの下部にあり、画面キーボードでカバーされている場合は、問題が発生する可能性があります。スクロールビューを、コンテンツがなくなるまでスクロールできるかどうかわからない。
私が見たのは、マニフェストで2つの矛盾するフラグを使用する可能性があるということです。
android:windowSoftInputMode="stateHidden|adjustResize|adjustPan" > </activity>
AdjustResizeとadjustPanを組み合わせることはできません。AdjustResizeだけでどのように見えるか試してみてください。これにより、キーボードがビューのすべてをカバーすることを回避できます。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加