我的活動有一個登錄表單。我需要這樣的邏輯:Android。點擊編輯文字時推送內容
http://www.clipular.com/c/6455748191322112.png?k=Xc28Y-FsMShuNpEXbWD5rpe6faY http://www.clipular.com/c/5414772807041024.png?k=k3TB9AiHEtdV8oh6G17Ag-MS2nI
我怎麼能做到這一點?我試圖在清單中設置android:windowSoftInputMode="adjustPan"
到Activity
,但這不起作用。
我的佈局:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/truck">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/logo"
android:layout_width="@dimen/login_logo_width"
android:layout_height="@dimen/login_logo_height"
android:layout_marginTop="@dimen/login_logo_margin_top"
android:layout_marginStart="@dimen/login_logo_margin_left"
android:src="@drawable/logo_transfort_white"
android:contentDescription="@string/logo_title"/>
<TextView
android:id="@+id/skip"
style="@style/GrayText"
android:layout_width="wrap_content"
android:layout_height="@dimen/default_text_height"
android:layout_alignEnd="@id/logo"
android:layout_alignParentEnd="true"
android:layout_marginEnd="@dimen/skip_button_margin_right"
android:layout_marginTop="@dimen/skip_button_margin_top"
android:gravity="center"
android:text="@string/skip" />
<LinearLayout
android:id="@+id/inputs"
android:background="@drawable/login_buttons_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/inputs_block_margin_top"
android:layout_marginStart="@dimen/inputs_block_margin_left_right"
android:layout_marginEnd="@dimen/inputs_block_margin_left_right"
android:layout_below="@id/logo"
android:orientation="vertical"
android:descendantFocusability="beforeDescendants"
android:focusableInTouchMode="true">
<EditText
android:id="@+id/login"
android:layout_width="match_parent"
android:layout_height="@dimen/default_text_height"
android:layout_marginTop="@dimen/inputs_block_margin_left_right"
android:layout_marginStart="@dimen/inputs_block_margin_left_right"
android:background="@color/text_color_white_transparent"
android:ems="16"
android:hint="@string/login"
style="@style/LoginInputs"/>
<View
android:id="@+id/inputs_line"
android:layout_width="wrap_content"
android:layout_height="@dimen/login_line_height"
android:layout_marginTop="@dimen/login_line_margin_top"
android:layout_marginStart="@dimen/inputs_block_margin_left_right"
android:layout_marginEnd="@dimen/inputs_block_margin_left_right"
android:background="@color/line_color_white_capacity" />
<EditText
android:id="@+id/password"
android:layout_width="match_parent"
android:layout_height="@dimen/default_text_height"
android:layout_marginTop="@dimen/login_line_margin_top"
android:layout_marginStart="@dimen/inputs_block_margin_left_right"
android:layout_marginBottom="@dimen/inputs_block_margin_left_right"
android:background="@color/text_color_white_transparent"
android:ems="16"
android:hint="@string/password"
android:inputType="textPassword"
style="@style/LoginInputs" />
</LinearLayout>
<TextView
android:id="@+id/forgot_password"
android:layout_width="wrap_content"
android:layout_height="@dimen/default_text_height"
android:layout_below="@id/inputs"
android:layout_alignParentEnd="true"
android:layout_marginTop="@dimen/forgot_password_margin_top"
android:layout_marginEnd="@dimen/inputs_block_margin_left_right"
android:text="@string/forgot_password"
android:gravity="center"
style="@style/WhiteText" />
<Button
android:id="@+id/enter"
android:background="@drawable/sigin_button_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/forgot_password"
android:layout_centerHorizontal="true"
android:layout_marginStart="@dimen/inputs_block_margin_left_right"
android:layout_marginEnd="@dimen/inputs_block_margin_left_right"
android:layout_marginTop="@dimen/signin_button_margin_top"
android:textColor="@android:color/white"
android:text="@string/enter_text" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/enter"
android:orientation="horizontal">
<TextView
android:id="@+id/no_account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/no_account_margin_left"
android:layout_marginTop="@dimen/no_account_margin_top"
android:text="@string/no_account"
style="@style/GrayText"/>
<TextView
android:id="@+id/check_in"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/check_in_margin_left"
android:layout_marginTop="@dimen/no_account_margin_top"
android:text="@string/check_in"
style="@style/WhiteText" />
</LinearLayout>
</RelativeLayout>
做一件事添加兩個按鈕,當你聽到鍵盤打開關閉,並根據鍵盤打開隱藏和顯示關閉 – param
還有一件事...我只有卡車的形象,這個圖像沒有黑色部分在底部 – blood73