近期看到同事写的一段代码,非常easy吧就是:

 <LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:orientation="horizontal"
android:gravity="center_vertical" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="XXXXX"
android:text="x"
/> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="(x)"
/>
</LinearLayout>

显示的效果例如以下:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvemhvdWRhaWxpYW5n/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt="">

是的效果就是这样,两个x之间有非常大的空隙,開始我以为是同事设置了什么,后来看了xml没看出什么。想到了以为是设置minWidth,可是也没有看到,关键是显示的效果确实有最小长度,找了半天,最后才意识到hint这个属性,设置了hint属性后,对应的TextView的最小宽度也会跟你设置的文字长度有关,这就是这个问题的终于原因,到此,我想说的结束了。。。

android:hint属性对TextView的影响的更多相关文章

  1. 【Android 应用开发】Android UI 设计之 TextView EditText 组件属性方法最详细解析

    . 作者 :万境绝尘  转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/18964835 . TextView 相关类的继承结构 ...

  2. Android UI 设计之 TextView EditText 组件属性方法最详细解析

    . 作者 :万境绝尘  转载请注明出处 : http://blog.csdn.net/shulianghan/article/details/18964835 . TextView 相关类的继承结构 ...

  3. Android EditText属性

    1.EditText输入的文字为密码形式的设置 (1)通过.xml里设置: 把该EditText设为:android:password="true" // 以”.”形式显示文本 ( ...

  4. android 布局属性详解

    Android功能强大,界面华丽,但是众多的布局属性就害苦了开发者,下面这篇文章结合了网上不少资料. 第一类:属性值为true或falseandroid:layout_centerHrizontal ...

  5. Android布局属性大全

    RelativeLayout http://wenku.baidu.com/view/2e39724333687e21af45a97e.html?from=related&hasrec=1 h ...

  6. [原创]Android秒杀倒计时自定义TextView

    自定义TextView控件TimeTextView代码: import android.content.Context; import android.content.res.TypedArray; ...

  7. android layout 属性大全

    第一类:属性值为true可false android:layout_centerHrizontal 水平居中 android:layout_centerVertical 垂直居中 android:la ...

  8. android:layout_weight属性的使用方法总结

    原创文章,转载请注明出处http://www.cnblogs.com/baipengzhan/p/6282826.html android:layout_weight属性可以和其他属性配合使用,产生多 ...

  9. Android TextEdit属性

    EditText继承关系:View-->TextView-->EditText 去掉边框 将EditText属性设置修改 android:background="@null&qu ...

随机推荐

  1. Digital controller compensates analog controller

    Emerging digital ICs for power control lack basic features, such as the built-in gate drive and curr ...

  2. linux下printf打印带颜色的字符串

    转载:http://blog.chinaunix.net/uid-28917424-id-3889917.html 前不久就在某位同学的博客里看到,但是今天找了好久没找到,就直接google了,现贴出 ...

  3. 咏南MORMOT中间件免费开源

    咏南MORMOT中间件免费开源 源码放QQ群(92449782)共享文件里面

  4. 【spring cloud】spring boot2.x下 使用feign,注解@EnableFeignClients 找不到的解决方法

    spring boot2.x下 使用feign,注解@EnableFeignClients 找不到的解决方法 在spring boot1.x下,使用注解@EnableFeignClients,jar包 ...

  5. Scrum 思考

    下个月就要离职,所以这个月特别清闲,上班时间都在上网看书,偶然在Startup News的一篇文章(http://blog.devtang.com/blog/2013/06/17/startup-an ...

  6. iOS:UIApplication和它对象的代理

    <1>UIApplication的对象是单例对象   类方法:UIApplication *app = [UIApplication sharedAppplication] <2&g ...

  7. 浏览器自动化测试初探 - 使用phantomjs与casperjs

    收录待用,修改转载已取得腾讯云授权 作者:yangchunwen 首先要解释一下为什么叫浏览器自动化测试,因为本文只关注发布后页面功能的自动化测试,也就是UI层面的自动化. 浏览器测试有别于js代码的 ...

  8. Zeppelin原理简介

    Zeppelin是一个基于Web的notebook,提供交互数据分析和可视化.后台支持接入多种数据处理引擎,如spark,hive等.支持多种语言: Scala(Apache Spark).Pytho ...

  9. 解决Ubuntu Ping网关Destination Host Unreachable错误

    ifconfig 检查了配置,没问题,是ok的, 检查了防火墙,是关闭的,邪乎了,是什么问题呢 各种尝试,最后,将 ip 搞成自动获取就 可以ping通了,但为啥手动设置就不行呢? 最后看了这个朋友的 ...

  10. 同一个数据库实例,不同用户下多表创建视图,Hibernate完毕ORM映射,Spring整合,后台实现

    1.同一个数据库实例.同用户,多表创建视图 2.同一个数据库实例,不同用户下.多表创建视图 3.同一个数据库,不同数据库实例,多表创建视图 4.不同类型数据库,多表创建视图 1.同一个数据库实例.同用 ...