android:WindowsofInputMode=";“调整大小”;它没有按应有的方式工作
尽管这个问题在stackoverflow中有很多解决方案,但我无法解决我的问题。 我在屏幕上有两个编辑文本,一个在顶部,另一个附在屏幕底部。 每当我点击底部的编辑文本,软键板就会出现在上面。我已经玩过WindowsOfInputMode了 当我点击底部编辑文本时,我不希望屏幕上的其他内容向上滚动 这是我的xml布局android:WindowsofInputMode=";“调整大小”;它没有按应有的方式工作,android,xml,android-layout,android-relativelayout,window-soft-input-mode,Android,Xml,Android Layout,Android Relativelayout,Window Soft Input Mode,尽管这个问题在stackoverflow中有很多解决方案,但我无法解决我的问题。 我在屏幕上有两个编辑文本,一个在顶部,另一个附在屏幕底部。 每当我点击底部的编辑文本,软键板就会出现在上面。我已经玩过WindowsOfInputMode了 当我点击底部编辑文本时,我不希望屏幕上的其他内容向上滚动 这是我的xml布局 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schema
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/background"
android:orientation="vertical"
>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<EditText
android:id="@+id/phone_number_edit_text_compose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_toLeftOf="@id/select_contact"
android:background="@drawable/phone_edittext_background_selector"
android:ems="10"
android:hint="@string/phone_edittext_hint"
android:inputType="phone"
android:paddingBottom="12dp"
android:paddingLeft="8dp"
android:paddingTop="12dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/white" />
<ImageButton
android:id="@+id/selectcontact_compose"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignBottom="@+id/phone_number_edit_text_compose"
android:layout_marginTop="@dimen/activity_horizontal_margin"
android:layout_toRightOf="@id/phone_number_edit_text_compose"
android:background="@drawable/select_contact_background_selector"
android:contentDescription="@string/select_contact_content_description"
android:src="@drawable/select_contact_selector"
android:layout_marginLeft="2dp"
android:paddingLeft="8dp"
android:paddingRight="8dp"/>
<View
android:id="@+id/view1"
android:layout_width="wrap_content"
android:layout_height="2px"
android:layout_below="@id/phone_number_edit_text_compose"
android:layout_marginTop="@dimen/redial_screen_distance_between_views"
android:background="@drawable/separator" />
<LinearLayout
android:id="@+id/repetition_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view1"
android:clickable="true"
android:onClick="RepetitionLayoutClickListener"
android:orientation="horizontal"
android:paddingBottom="@dimen/redial_screen_distance_between_views"
android:paddingTop="@dimen/redial_screen_distance_between_views"
android:background="@drawable/repetition_layout_background_selector"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
<TextView
android:id="@+id/repetition_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/repetition"
android:textColor="@color/green"
android:textAppearance="?android:attr/textAppearanceLarge" />
<Spinner
android:id="@+id/repetition_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:popupBackground="@color/dark_background" />
</LinearLayout>
<View
android:id="@+id/view2"
android:layout_width="wrap_content"
android:layout_height="2px"
android:layout_below="@id/repetition_layout"
android:background="@drawable/separator" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view2"
android:orientation="horizontal"
android:paddingBottom="@dimen/redial_screen_distance_between_views"
android:paddingTop="@dimen/redial_screen_distance_between_views"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:id="@+id/date_layout">
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/d"
android:textColor="@color/green"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/date_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/a"
android:paddingLeft="5dp"
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
<View
android:id="@+id/view3"
android:layout_width="wrap_content"
android:layout_height="2px"
android:layout_below="@id/date_layout"
android:background="@drawable/separator" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/view3"
android:orientation="horizontal"
android:paddingBottom="@dimen/redial_screen_distance_between_views"
android:paddingTop="@dimen/redial_screen_distance_between_views"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:id="@+id/time_layout">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/t"
android:textColor="@color/green"
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:id="@+id/time_textview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/b"
android:paddingLeft="5dp"
android:textColor="@color/white"
android:textAppearance="?android:attr/textAppearanceLarge" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="@+id/compose_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1">
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/compose_message_background"
android:hint="@string/compose_message_hint"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_toLeftOf="@+id/imageButton1" >
</EditText>
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/send_button_background"
android:src="@drawable/ic_action_send_now"
android:paddingRight="8dp"
android:paddingLeft="8dp"
android:layout_alignBottom="@+id/editText1"
android:layout_alignTop="@+id/editText1"
android:layout_alignParentRight="true"/>
</RelativeLayout>
</LinearLayout>
这是我的清单xml
<activity
android:name="com.task.SmsScreen"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
>
</activity>
您应该使用
<activity
android:name="com.task.SmsScreen"
android:label="@string/app_name"
android:windowSoftInputMode="adjustPan"
>
</activity>
移除外部线性布局,并将所有内容放在相对布局内。并通过使alignParentBottom为真,将底部编辑文本和布局底部对齐。 最重要的是“不要对android做任何事情:WindowsOfInputMode。”从清单文件中删除该行。
默认设置为android。您没有说明编译的android版本以及运行的android版本。
但请检查您是否可能使用由about-android:windowFullscreen属性设置的全屏选项,或者通过设置FLAG\u FULSCREEN设置的全屏选项。这会阻止adjusrResize选项在较新的API上正确写入。它适用于API 10(2.3.5)。经过两天的讨论,阅读了我自己提出的所有stackoverflow解决方案。这对我有用。 我不得不使用scrollview,然后它通过缩小视图在狭小的空间中进行自我调整。没有scrollview,我不得不使用最外层的线性布局,布局为重力:底部。但是有了这个设置,所有的元素都会落在屏幕的底部。如果使用layout_margintop或layout_marginbottom,则当键盘弹出一些textview或edittextview时,会从屏幕上扔掉。。格瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞瑞 所以,我终于找到了这个解决方案,希望它能解决你的一些问题 在Manifest.xml中
在布局中:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/love_bg_red_10"
android:gravity="center"
android:orientation="vertical"
tools:context="${packageName}.${activityClass}" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="@+id/txtvwYourName"
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_gravity="center"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@layout/border_header"
android:gravity="center"
android:text="Your Name"
android:textColor="#FFF"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="@+id/edttxtFistName"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@layout/border_edittextview"
android:gravity="center"
android:hint="Type your name here"
android:includeFontPadding="false"
android:inputType="textPersonName"
android:lines="1"
android:maxLength="30"
android:tag="edttxtFistName"
android:textAllCaps="false"
android:textColor="#FFF"
android:textSize="20sp" />
<TextView
android:id="@+id/txtvwFavPersonName"
android:layout_width="fill_parent"
android:layout_height="35dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@layout/border_header"
android:gravity="center"
android:text="Name of your favorite person"
android:textColor="#FFF"
android:textSize="20sp"
android:textStyle="bold" />
<EditText
android:id="@+id/edttxtLastName"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:layout_marginBottom="35dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="@layout/border_edittextview"
android:gravity="center"
android:hint="Type your favorite person's name"
android:inputType="textPersonName"
android:lines="1"
android:maxLength="30"
android:tag="edttxtLastName"
android:textColor="#fff"
android:textSize="20sp" />
<Button
android:id="@+id/btnCalculate"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@layout/button_background"
android:text="Calculate"
android:textSize="20sp"
android:textStyle="bold" >
</Button>
</LinearLayout>
</ScrollView>
在scrollview之后放置一个Linearlayout封闭标记
安卓真的很糟糕
设备信息
Devcie:Xperia Z
果冻豆
[不知道它在旧版本中会如何运行。]谢谢,但我不希望在单击底部编辑文本时屏幕上的其他内容向上滚动。使用此android:WindowsOfInputMode=“adjustPan | stateVisible”试试
android:WindowsOfInputMode=“StateAllwayShidden | adjustPan”
@Piyusgupta我与所有Piyush组合玩过。。。这会向上滚动屏幕上的所有其他内容。@RethinavelPillai这会向上滚动屏幕上的所有其他内容。这对我来说很有效,尽管我真的不知道为什么它会与亲戚一起工作,而与线性关系无关