Android软键盘将布局向上推,但之后将其隐藏';让我们不要后退。如何解决它';s
在我的片段中有一首流行歌曲Android软键盘将布局向上推,但之后将其隐藏';让我们不要后退。如何解决它';s,android,android-edittext,android-softkeyboard,Android,Android Edittext,Android Softkeyboard,在我的片段中有一首流行歌曲 弹出窗口全屏显示 PopupWindow中有EditText 当我点击编辑文本时,软键盘显示并向上推我的弹出窗口 当我隐藏软键盘时,我的弹出窗口不会下拉。为什么?如何解决这个问题 我尝试设置android:windowSoftInputMode=“adjustPan”和android:windowSoftInputMode=“adjustResize”但不起作用(我的弹出窗口未下拉) 编辑 1.这是我的弹出式布局中的编辑文本 <LinearLayout
android:windowSoftInputMode=“adjustPan”
和android:windowSoftInputMode=“adjustResize”
但不起作用(我的弹出窗口未下拉)
编辑
1.这是我的弹出式布局中的编辑文本
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edt_popname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="68dp"
android:minWidth="300dp"
android:gravity="center_horizontal|center_vertical"
android:textSize="30dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:imeOptions="actionNext"/>
</RelativeLayout>
<RelativeLayout
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/edt_popprice"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minHeight="68dp"
android:minWidth="300dp"
android:gravity="center_horizontal|center_vertical"
android:textSize="30dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:imeOptions="actionNext"/>
</RelativeLayout>
</LinearLayout>
3.此代码用于显示弹出窗口
private AdapterView.OnItemClickListener ItemGridViewItemClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) {
ItemInfo info = (ItemInfo) adapterView.getItemAtPosition(position);
Log.i("ItemClick", info.getName());
popupWindow.showAtLocation(rootView, Gravity.CENTER, 0, 0);
}
};
private AdapterView.OnItemClickListener项GridViewItemClickListener=new AdapterView.OnItemClickListener(){
@凌驾
public void onItemClick(AdapterView AdapterView,视图视图,整型位置,长id){
ItemInfo=(ItemInfo)adapterView.getItemAtPosition(位置);
Log.i(“ItemClick”,info.getName());
弹出窗口显示位置(根视图,重心,0,0);
}
};
4.这是清单中的活动
<activity
android:name=".MainActivity"
android:clearTaskOnLaunch="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
</activity>
我自己也厌倦了类似的代码,弹出窗口正在为我调整大小,所以对于您的情况和解决此场景,您可以这样做
请按照上面的说明进行操作,如果您遇到任何其他问题,请告诉我。您能把代码放在这里吗?@Techfist请在下面的编辑中查看我的代码。非常感谢。你的建议很有效,但我可以用对话框而不是弹出窗口来解决。这对我来说很有效。
<activity
android:name=".MainActivity"
android:clearTaskOnLaunch="true"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustPan">
</activity>