SoftKey comes over the Edittext -- Android



我正在开发一个Android应用程序。当焦点出现在其中一个 EditText(在页面的下端)上时,键盘会覆盖 EditText,所以当我抠像文本时,我看不到正在键入的内容。我有哪些选择?

如何在屏幕上将编辑文本移动到更高的位置?

我试过了 <activity name="YourActivity" android:windowSoftInputMode="stateVisible|adjustResize"> </activity>

<activity name="YourActivity"
android:windowSoftInputMode="stateVisible|adjustPan">

这是代码

FrameLayout container =  (FrameLayout) this.findViewById(R.id.Container);
    LayoutInflater mInflater = LayoutInflater.from(this);
    RelativeLayout setRelativeLayout = (RelativeLayout) mInflater.inflate(R.layout.layout_main, null);
    container.addView(setRelativeLayout);

这对我不起作用。

调整大小和调整平移不适合您的事实表明您的布局填满了屏幕,Android 无法调整它为键盘腾出空间。但是,如果您的布局包含在滚动视图中,则可能会解决问题。

您当前对相对布局进行膨胀,并将其添加到框架布局中。我建议您尝试创建一个ScrollView,向其添加RelativeLayout,然后将ScrollView添加到FrameLayout中:

FrameLayout container =  (FrameLayout) this.findViewById(R.id.Container);
LayoutInflater mInflater = LayoutInflater.from(this);
RelativeLayout setRelativeLayout = (RelativeLayout) mInflater.inflate(R.layout.layout_main, null);
ScrollView sv = new ScrollView(this);
sv.addView(setRelativeLayout);
container.addView(sv);

最新更新