【发布时间】:2016-07-07 12:23:33
【问题描述】:
我有下一个布局
当键盘出现时,我不希望布局的绿色标记部分始终可见。另一个词我需要同时看到 EditText 和 Button。
这是我的代码草图:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:fab="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_margin="16dp"
tools:context="com.mynfo.concept.auth.AuthActivity">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/titleImageView"
android:layout_gravity="center"
android:src="@drawable/title_auth"
android:layout_weight="0"
android:layout_marginTop="48dp"
android:layout_marginBottom="48dp"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_marginBottom="8dp"
android:focusable="true"
android:focusableInTouchMode="true"
>
<EditText
android:id="@+id/barcode_editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:inputType="number"
android:textColorHint="@color/darker_grey"
android:hint="edittext"
android:maxLength="15"
android:ellipsize="end"
android:ems="10"
android:background="#0000"
android:layout_gravity="left|center_vertical"/>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera"
android:layout_gravity="right|center_vertical"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey"
android:layout_gravity="bottom"/>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_weight="1">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
<com.melnykov.fab.FloatingActionButton
android:id="@+id/button_scan"
android:layout_width="64dp"
android:layout_height="64dp"
fab:fab_colorNormal= "@color/turquoise"
fab:fab_colorPressed= "@color/turquoise_black"
fab:fab_colorRipple= "@color/turquoise_light"
android:src="@android:drawable/ic_menu_camera"
android:layout_gravity="center"/>
</FrameLayout>
<Button
android:id="@+id/button_link_card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Authorize"
android:background="@drawable/button_authorize_selector"
android:enabled="false"
android:layout_weight="0"
/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.2">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center"
android:gravity="center">
<TextView
style="@style/TextViewPrimary"
android:layout_marginLeft="32dp"
android:layout_marginRight="32dp"
android:textSize="16sp"
android:text="Enter your name"
android:gravity="center" />
<com.mynfo.concept.views.FontFitTextView
style="@style/TextViewSecondary"
android:text="And then you will got the access"
android:gravity="center" />
</LinearLayout>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/authenticatingView"
android:background="#fff">
<ProgressBar
style="?android:attr/progressBarStyleLarge"
android:indeterminateOnly="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/authenticatingProgressBar"
android:layout_gravity="center"/>
</FrameLayout>
</FrameLayout>
</LinearLayout>
没用的:adjustPan、adjustSize 带或不带布局权重。
也许我做错了什么?
感谢您的进一步帮助。
附:我知道这段代码感觉很多余,但有一些目的,比如屏幕适应。
【问题讨论】:
-
android:windowSoftInputMode="adjustResize" 在清单中添加这个
-
其实不行
-
你能提供完整的代码而不是草图吗?你的整个 xml
标签: android keyboard resize ime