请验证我的布局:底部按键不断想出了键盘 [英] Please verify my layout: bottom button keeps coming up over keyboard
问题描述
我有没有几乎我想要什么的布局。这里有一个关于底部的按钮错误。我应该留在底部在任何时候。但每当我调出软键盘按钮的键盘上方显示。这不是我想要的,但它应该成为覆盖键盘。
此外,我会很高兴,如果你能在评论如何布局的构建。
谢谢, steff
< XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直>
<的LinearLayout机器人:ID =@ + ID / l_layout_tags
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=横向>
<的TextView
机器人:文本=标签
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT/>
< AutoCompleteTextView机器人:ID =@ + ID / actv_tags
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =1
机器人:imeOptions =actionDone/>
< ImageButton的机器人:ID =@ + ID / btn_add_tag
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@机器人:可绘制/ ic_input_add
机器人:的onClick =addTag/>
< / LinearLayout中>
<滚动型机器人:ID =@ + ID / sv_scroll_contents
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_below =@ ID / l_layout_tags
机器人:scrollbarFadeDuration =2000>
< TableLayout机器人:ID =@ + ID / t_layout_contents
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:stretchColumns =1
机器人:paddingRight =5dip>
<的TableRow机器人:ID =@ + ID / tr_template>
< ImageView的机器人:ID =@ + ID / iv_blank
机器人:SRC =@机器人:彩色/透明/>
< EditText上机器人:ID =@ + ID / et_content1
机器人:重力=顶
机器人:=了maxWidth200dp
机器人:imeOptions =actionDone/>
< /的TableRow>
< / TableLayout>
< /滚动型>
<的LinearLayout机器人:ID =@ + ID / l_layout_media_btns
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:方向=横向
机器人:layout_centerHorizontal =真
机器人:layout_below =@ ID / sv_scroll_contents>
< ImageButton的机器人:ID =@ + ID / btn_camera
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@机器人:可绘制/ ic_menu_camera
机器人:的onClick =takePicture/>
< ImageButton的机器人:ID =@ + ID / btn_video
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@机器人:可绘制/ ic_menu_camera/>
< ImageButton的机器人:ID =@ + ID / btn_audio
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@机器人:可绘制/ ic_btn_speak_now/>
< ImageButton的机器人:ID =@ + ID / btn_sketch
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:SRC =@机器人:可绘制/ ic_menu_edit/>
< / LinearLayout中>
< ImageButton的机器人:ID =@ + ID / btn_save_note
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:SRC =@机器人:可绘制/ ic_menu_upload/>
< / RelativeLayout的>
添加机器人:windowSoftInputMode =adjustPan
在AndroidManifest.xml中的活动标记
这样,软键盘会不会调整你的布局和按钮将停留在它之下。 看看这里以获取有关不同的软键盘模式下会有更好的主意。
I have a layout which does almost what I want. There's just one bug regarding the button at the bottom. I should stay at the bottom at all times. But whenever I bring up the soft-keyboard the button will be displayed above the keyboard. This is not what I want but it should become covered by the keyboard.
Moreover, I'd be happy if you could comment on how the layout's built.
Thanks, steff
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout android:id="@+id/l_layout_tags"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:text="TAGS:"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<AutoCompleteTextView android:id="@+id/actv_tags"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:imeOptions="actionDone" />
<ImageButton android:id="@+id/btn_add_tag"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_input_add"
android:onClick="addTag"/>
</LinearLayout>
<ScrollView android:id="@+id/sv_scroll_contents"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@id/l_layout_tags"
android:scrollbarFadeDuration="2000" >
<TableLayout android:id="@+id/t_layout_contents"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1"
android:paddingRight="5dip">
<TableRow android:id="@+id/tr_template">
<ImageView android:id="@+id/iv_blank"
android:src="@android:color/transparent" />
<EditText android:id="@+id/et_content1"
android:gravity="top"
android:maxWidth="200dp"
android:imeOptions="actionDone" />
</TableRow>
</TableLayout>
</ScrollView>
<LinearLayout android:id="@+id/l_layout_media_btns"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerHorizontal="true"
android:layout_below="@id/sv_scroll_contents" >
<ImageButton android:id="@+id/btn_camera"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera"
android:onClick="takePicture" />
<ImageButton android:id="@+id/btn_video"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera" />
<ImageButton android:id="@+id/btn_audio"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_btn_speak_now" />
<ImageButton android:id="@+id/btn_sketch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_edit" />
</LinearLayout>
<ImageButton android:id="@+id/btn_save_note"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:src="@android:drawable/ic_menu_upload" />
</RelativeLayout>
Add android:windowSoftInputMode="adjustPan"
to your activity tag in the AndroidManifest.xml.
This way, the software keyboard won't resize your layout and your button will stay under it. Take a look here to get a better idea about different soft keyboard modes.
这篇关于请验证我的布局:底部按键不断想出了键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!