4

Sherlock アクション タブを使用しているため、タブのフラグメント アクティビティがあります。残念ながら、キーボードが表示されると、次のことが起こります。

ここに画像の説明を入力

キーボードは、3 番目のテキスト ボックスのすぐ下にある 2 つのボタンに重なっています。ただし、キーボードが開いているときに 2 つのボタンが表示されるようにします。

私はいくつかのことを試しました:

  • これらの 3 つのタブを収容するアクティビティに追加android:windowSoftInputMode="adjustResize"されましたandroid:windowSoftInputMode="adjustPan"
  • 2 つのボタンを表示するために画面をスクロールできるように部分的に機能するスクロール ビューで、図解されたタブ フラグメントをラップしました。

これはフラグメントの XML です。

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

    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#EBEBEB"
    android:orientation="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="20dp"
        android:layout_weight="1"
        android:gravity="right" >

        <EditText
            android:id="@+id/TextBox"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="#ffffff"
            android:height="50dp"
            android:hint="@string/BoxHint"
            android:paddingLeft="15dp" >
        </EditText>

        <TextView
            android:id="@+id/LocBoxHint"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_below="@+id/TextBox"
            android:background="#ffffff"
            android:gravity="center"
            android:padding="10dp"
            android:text="\@"
            android:textSize="22dp" />

        <EditText
            android:id="@+id/LocBox"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_below="@+id/TextBox"
            android:layout_toRightOf="@+id/LocBoxHint"
            android:background="#ffffff"
            android:hint="Joey&apos;s Pizza" >
        </EditText>

        <TextView
            android:id="@+id/DateTimeBoxHint"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_below="@+id/LocBoxHint"
            android:background="#ffffff"
            android:gravity="center"
            android:padding="10dp"
            android:text="#"
            android:textSize="22dp" />

        <EditText
            android:id="@+id/DateTimeBox"
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_below="@+id/LocBox"
            android:layout_toRightOf="@+id/DateTimeBoxHint"
            android:background="#ffffff"
            android:hint="Friday 8pm"
            android:paddingRight="60dp"
            android:layout_marginBottom="50dp" />

        <ImageButton
            android:id="@+id/DateTimePicker"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/LocBox"
            android:onClick="dateTimeButton"
            android:src="@drawable/ic_menu_today"
            android:background="#ffffff" />

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="50dp"
            android:layout_below="@+id/DateTimeBox"
            android:orientation="horizontal"
            android:layout_marginTop="-50dp" >

            <Button
                android:id="@+id/infoButton"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_weight="5"
                android:onClick="infoButton"
                android:text="i"
                android:textColor="#ffffff" />

            <Button
                android:id="@+id/Button"
                android:layout_width="fill_parent"
                android:layout_height="50dp"
                android:layout_weight="2"
                android:onClick="planButton"
                android:text="@string/Button"
                android:textColor="#ffffff"
                />
        </LinearLayout>

    </RelativeLayout>
</LinearLayout>

何かご意見は?

4

1 に答える 1

2

親レイアウトは線形であり、次のコードのように相対レイアウトで変更します

<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/linearLayout1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/theme_black_bg" >

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_above="@+id/bottom_bar"
        android:layout_below="@+id/top_bar"
        android:layout_marginTop="15dip"
        android:gravity="center_horizontal"
        android:orientation="vertical" >
        <LinearLayout
            android:id="@+id/linearlayout"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/email_edit_bg"
            android:gravity="center_horizontal"
            android:orientation="vertical" >
            <EditText
                android:id="@+id/LoginEmailAddressEditTextView"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:background="@drawable/edit_text_bg"
                android:ems="2"
                android:hint="Please enter email"
                android:paddingLeft="5dip"
                android:paddingRight="5dip"
                android:focusable="true"
                android:focusableInTouchMode="true"
                android:singleLine="true"
                android:textColor="@color/label_color_white"
                android:textColorHint="#FFFFFFFF"
                android:textSize="12sp" />

        </LinearLayout>
        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dip"
            android:layout_marginTop="10dip"
            android:background="@drawable/separator_bg" />
        <EditText
            android:id="@+id/LoginPasswordEditTextView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_text_bg"
            android:ems="2"
            android:hint="@string/hint_password"
            android:inputType="textPassword"
            android:paddingLeft="5dip"
            android:paddingRight="5dip"
            android:singleLine="true"
            android:textColor="@color/label_color_white"
            android:textColorHint="#FFFFFFFF"
            android:textSize="12sp" />

        <Button
            android:id="@+id/LoginScreenLoginButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:background="@drawable/login_btn_selector" />
        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dip"
            android:layout_marginTop="10dip"
            android:background="@drawable/separator_bg" />
        <Button
            android:id="@+id/LoginScreenForgotPasswordButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            android:background="@drawable/forgot_password_btn_selector" />
    </LinearLayout>
    <include
        android:id="@+id/bottom_bar"
        android:layout_alignParentBottom="true"
        layout="@layout/bottom_advertisement_merge_layout" />
</RelativeLayout>
于 2013-02-09T04:24:35.543 に答える