EditText自动换行

EditText自动换行

*EditText设置android:inputType属性的话,自动换行功能会无效。

*完善EditText的自动换行功能也可以通过自定义控件实现,如:http://dev.10086.cn/cmdn/bbs/redirect.php?tid=69767&goto=lastpost

 

以下是网络摘录其他相关内容

1.如何对EditText进行setText()的时候使其自动换行 
<EditText android:layout_width="200dp" android:layout_height="wrap_content"  
       android:id="@+id/input" android:singleLine="false"   
        />  

 我们只要确保singleLine为false的话,并且设置宽度一定,就可以自动换行,注意在这里不要设置
input.setInputType(0);  不然就不会自动换行 

2.在TableLayout中布局一行,设置EditText的xml属性: 
< !-- android:shrinkColumns="1" shrinks the 2nd column to fit the window -->  
< !-- android:stretchColumns="1" stretches the 2nd column -->  
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"  
   android:layout_width="fill_parent" android:layout_height="fill_parent"  
   android:orientation="vertical" android:paddingLeft="5dp"  
   android:paddingRight="5dp" android:stretchColumns="1">  
 
 
   <TableRow android:layout_width="fill_parent"  
       android:layout_height="wrap_content" android:orientation="horizontal">  
       <TextView android:layout_width="wrap_content"  
           android:layout_height="wrap_content" android:text="Email"  
           android:paddingRight="5dp">  
       </TextView>  
       <EditText android:id="@+id/txtEmail" android:layout_width="200dp"  
           android:layout_height="wrap_content" android:textSize="18sp"  
           android:singleLine="false" android:inputType="textEmailAddress">  
       </EditText>  
   </TableRow>  
 
 
< /TableLayout>   


3.如何设置EditText隐藏键盘 

(EditText)mMarket.setInputType(0);  


4.如何设置EditText不被输入法遮盖 
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值