ZNDS智能电视网 推荐当贝市场

TV应用下载 / 资源分享区

软件下载 | 游戏 | 讨论 | 电视计算器

综合交流 / 评测 / 活动区

交流区 | 测硬件 | 网站活动 | Z币中心

新手入门 / 进阶 / 社区互助

新手 | 你问我答 | 免费刷机救砖 | ROM固件

查看: 8581|回复: 0
上一主题 下一主题
[教程]

EditText的一些使用注意点

[复制链接]
跳转到指定楼层
楼主
发表于 2013-8-28 16:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
31.如何对EditText进行setText()的时候使其自动换行   
   
Java代码   
<EditText android:layout_width="200dp" android:layout_height="wrap_content"     
        android:id="@+id/input" android:singleLine="false"      
         />     
   
  我们只要确保singleLine为false的话,并且设置宽度一定,就可以自动换行,注意在这里不要设置   
Java代码   
input.setInputType(0);     
   
不然就不会自动换行   
   
2.在TableLayout中布局一行,设置EditText的xml属性:   
Java代码   
< !-- 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隐藏键盘   
   
Java代码   
(EditText)mMarket.setInputType(0);     
   
   
4.如何设置EditText不被输入法遮盖   
Java代码   
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);   

上一篇:Android开发指南1-框架主题-基础知识
下一篇:介绍AsyncTask的用法用法
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|新帖|标签|软件|Sitemap|ZNDS智能电视网 ( 苏ICP备2023012627号 )

网络信息服务信用承诺书 | 增值电信业务经营许可证:苏B2-20221768 丨 苏公网安备 32011402011373号

GMT+8, 2024-5-6 05:21 , Processed in 0.059423 second(s), 15 queries , Redis On.

Powered by Discuz!

监督举报:report#znds.com (请将#替换为@)

© 2007-2024 ZNDS.Com

快速回复 返回顶部 返回列表