美文网首页
2.3.1TextView控件

2.3.1TextView控件

作者: EDU_MJ | 来源:发表于2017-10-26 19:38 被阅读0次

简介

TextView控件是一个文本框,经常使用的一个控件。

常用属性

|属性|含义|属性值
|-|-|
|android:text|显示文本|
|android:textColor|文本颜色|"#000000"采用六位十六进制的RGB颜色模式|
|android:textSize|文本大小|通常使用sp作为字体的单位|
|android:textStyle|文本样式|bold表示粗体,italic表示斜体,bolditalic(粗斜体)|
|android:gravity|文本在控件中的位置|可选left,right,top,bottom,center等|
|android:maxLength|文本的长度,超出不显示|
|android:drawableLeft|在文本左侧显示图片|
|android:drawableRight|在文本右侧显示图片|
|android:drawableTop|在文本上面显示图片|
|android:drawableBottom|在文本下面显示图片|

例如:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">
    <TextView
        android:layout_width="200dp"
        android:layout_height="50dp"
        android:text="hello world"
        android:textColor="#FF0000"
        android:textSize="20sp"
        android:textStyle="bold"
        android:gravity="bottom"
        android:maxLength="10"
        android:drawableLeft="@mipmapic_launcher_round"
        />

</LinearLayout>

小技巧

属性的叠加

相关文章

  • 2.3.1TextView控件

    简介 TextView控件是一个文本框,经常使用的一个控件。 常用属性 |属性|含义|属性值|-|-||andro...

  • dropDownButton使用方法

    添加DropDownButton 控件添加PopuMenu控件DropDownButton控件绑定PopuMenu控件

  • Android开发之自定义View流程

    Android控件架构 ViewGroup控件和View控件,ViewGroup控件作为父控件包含了多个View,...

  • 11.7

    今天学习了列表框控件、组合框控件、单选按钮控件、复选按钮控件、分组框控件。。。。。

  • HTML5 input 新增的表单控件

    必填项验证 颜色选择控件 日期选择控件 时间选择控件 电子邮件控件:提交表单时有格式验证 数字控件 文件控件 拖拽...

  • 关于winform父子控件以及控件之间方法调用/传值

    子控件获取父控件中的其他子控件 父控件访问子控件与上述例子类似

  • 组合控件2——海贼王选项菜单

    之前的自定义控件——初识自定义控件,我们了解到了自定义控件分为三种,自制控件,组合控件,拓展控件。而我们在自制控件...

  • 11.7

    第七章的列表框控件、组合框控件、单选按钮控件、复选按钮控件、分组框控件。

  • React专题4: 组件间通信

    父控件 传值 给子控件, 父控件可以将值 赋给子控件的一个属性(属性赋值)子控件 传值 给父控件, 需要父控件将自...

  • React中父、子控件方法的互相调用

    1.子控件调用父控件的方法 父控件: 子控件: (1)在父控件中通过

网友评论

      本文标题:2.3.1TextView控件

      本文链接:https://www.haomeiwen.com/subject/xqtlpxtx.html