我有查看尋呼機裏面的活動與四個片段,每個片段的中心編輯文本和底部的按鈕。但是當軟鍵盤彈出時,按鈕不作相應的調整,按鈕不可見(位於鍵盤後面)。調整調整大小的活動查看傳呼機不工作以上21
我的代碼:
main_activity.xml //activity layout
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
tools:openDrawer="start">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
layout="@layout/toolbar_main_screen"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<android.support.design.widget.TabLayout
android:id="@+id/tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="scrollable"
android:visibility="gone"
/>
<android.support.v4.view.ViewPager
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
</LinearLayout>
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/white"
android:fitsSystemWindows="true"
app:itemBackground="@drawable/nav_item_background"
app:itemTextAppearance="@style/NavDrawerTextStyle"
app:headerLayout="@layout/drawer_header"
app:menu="@menu/drawer_menu" />
</android.support.v4.widget.DrawerLayout>
first_fragment.xml //fragment_layout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:fitsSystemWindows="true"
android:padding="40dp">
<LinearLayout
android:layout_alignParentBottom="true"
android:id="@+id/buttons"
android:background="#000000"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="#000000"
android:text="BACK"
android:visibility="invisible"
android:textColor="#ffffff" />
<Button
android:id="@+id/next_degree"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:background="@drawable/button_next"
android:text="Next"
android:layout_marginLeft="@dimen/size40dp"
android:textSize="@dimen/fontSize16sp"
android:textColor="@color/black" />
</LinearLayout>
<AutoCompleteTextView
android:layout_centerInParent="true"
android:imeOptions="actionDone"
android:maxLines="1"
android:layout_marginTop="@dimen/size8dp"
android:layout_width="match_parent"
android:id="@+id/degree"
android:backgroundTint="@color/black"
android:layout_height="wrap_content"
android:text="B.Tech"
android:textSize="@dimen/fontSize20sp"
android:textColor="@color/white"
android:textCursorDrawable="@drawable/color_cursor"
/>
<TextView
android:layout_above="@id/degree"
android:paddingLeft="4dp"
android:textColor="#999999"
android:text="Degree *"
android:textSize="@dimen/fontSize16sp"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
在manifiest.xml加入這一行的活動'裏面的android:windowSoftInputMode =「stateHidden | adjustResize」' –
編輯和發佈您的XML – jagapathi
安置自己的XML和Java代碼 – EKN