android edittext 键盘完成,android – 基于键盘调整EditText高度

我在

android中有一个活动,其中有一个编辑框和编辑框下面的3个按钮.请查看附件.启动此活动时,默认状态为STATE1.(请参阅图像).键盘默认可见.现在,当我按下后退按钮或处理键盘时,我希望重新调整edittext并占用整个屏幕,如STATE2所示.

我不知道如何做到这一点.我将edittext的高度硬编码为基于目标设备的某些dp.我相信这必须改变.任何人都可以帮助我如何实现这一目标.

布局文件的XML和screencap一样

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:background="#FFFFFF" >

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical" >

android:id="@+id/EditMessage"

android:layout_width="fill_parent"

android:layout_height="150dp"

android:background="@drawable/newback"

android:gravity="top"

android:imeOptions="actionDone"

android:inputType="textMultiLine|textFilter|textVisiblePassword|textNoSuggestions"

android:maxLength="200"

android:padding="5dp"

android:textAppearance="?android:attr/textAppearanceMedium"

android:textColor="#000000"

/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:orientation="horizontal" >

android:id="@+id/PostMessage"

android:layout_width="0dp"

android:layout_height="45dp"

android:layout_weight="1"

android:layout_marginRight="0.2dp"

android:background="@drawable/newbutton_corner"

android:text="@string/SubmitMessage"

android:textColor="#FFFFFF"

android:textStyle="bold" />

android:id="@+id/CancelMessage"

android:layout_width="0dp"

android:layout_height="45dp"

android:layout_weight="1"

android:layout_marginRight="0.2dp"

android:background="@drawable/newbutton_corner"

android:text="@string/CancelMessage"

android:textColor="#FFFFFF"

android:textStyle="bold" />

android:id="@+id/DeleteMessage"

android:layout_width="0dp"

android:layout_height="45dp"

android:layout_weight="1"

android:background="@drawable/newbutton_corner"

android:text="@string/DeleteMessage"

android:textColor="#FFFFFF"

android:textStyle="bold" />

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值