怎样的EditText和软键盘之间发生的空间? [英] How place space between edittext and soft keyboard?
问题描述
我要放置的EditText和softkeyboard之间10dp保证金
I want to place 10dp margin between edittext and softkeyboard
下面是我的XML
<RelativeLayout
android:id="@+id/BottomLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:background="@drawable/bottom_glass" >
<EditText
android:id="@+id/message"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/grey"
android:ems="10"
android:layout_marginBottom="10dp"
android:hint="Enter Message"
android:textColor="#ffffff" >
</EditText>
<ImageButton
android:id="@+id/sendMessageButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="@+id/message"
android:background="@android:color/transparent"
android:src="@drawable/sendselector" />
<ImageButton
android:id="@+id/imageButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@+id/message"
android:background="@android:color/transparent"
android:src="@drawable/sendmediaselector" />
</RelativeLayout>
下面是我的code
在的onCreate
功能,我已经加入
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
messageText.setOnTouchListener(new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
((Swipe)getActivity()).getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
return false;
}});
我使用viewpager和全屏幕主题此编辑文本是我的第三个片段。
我使用安卓windowSoftInputMode =adjustResize | adjustPan
和安卓windowSoftInputMode =adjustResize
却没有任何反应
I am using viewpager and full screen theme this edit text is in my 3rd fragment.
I've used android:windowSoftInputMode="adjustResize|adjustPan"
and android:windowSoftInputMode="adjustResize"
but nothing happened.
感谢
推荐答案
我觉得 paddingBottom会
的属性可以影响之间的 EDITTEXT <距离/ code>和键盘。你可以这样做:
I find the attribute of paddingBottom
can effect the distance between the editText
and the keyboard. You can do like this:
<RelativeLayout
layout_width="match_parent"
layout_height="110dp">
<ImageView
layout_width="match_parent"
layout_height="100dp"
background="@drawable/your_edit_text_background"/>
<EditText
layout_width="match_parent"
layout_height="match_parent"
padding_bottom="10dp"/>
</RelativeLayout>
这会让你的键盘保证金您的EditText 10 DP
This will make your keyboard margin your EditText 10 dp
这篇关于怎样的EditText和软键盘之间发生的空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!