zoukankan      html  css  js  c++  java
  • Android基础-TextView(文本控件)

    TextView主要用于文本显示

     属性

        1.android:textSize="22sp" 设置文本字体

        2.android:textColor="#00ffff" 设置文本颜色

        3.android:lineSpacingExtra="15sp" 设置文本的间距 

        4.android:lineSpacingMultiplier="2" 设置文本的倍距

        5.android:text="@string/long_text" 设置文本内容

        6.android:singleLine="true" 设置单行 android:lines="1" 也是设置单行

        7.android:ellipsize="start" 将省略号设置在前面 ="end" 将省略号设置在后面 

        8.android:focusable="true" 设置可以获取屏幕的焦点 

        9.android:focusableInTouchMode="true" 设置触摸时可以获取屏幕的焦点 

        10.android:marqueeRepeatLimit = "marquee_forever" 跑马灯的次数为无限次

    1.Text 示例1

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".TextActivity">
    
        <!--android:textSize="22sp" 设置字体大小
        android:textColor="#00ffff" 设置字体颜色
        android:lineSpacingMultiplier="2" 倍距
        android:lineSpacingExtra="15sp"
    
        -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:textSize="22sp"
            android:textColor="#00ffff"
            android:lineSpacingExtra="15sp"
            android:text="@string/long_txt"/>
    
    
    </ScrollView>

    Text 示例2

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".TextActivity">
    
        <!--android:focusable="true" 设置可以获得屏幕的焦点
        android:focusableInTouchMode="true"  设置触摸时可以获取屏幕的焦点
        android:marqueeRepeatLimit="marquee_forever" 跑马灯的次数为无限次
    
        -->
        <TextView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:ellipsize="marquee"
            android:focusable="true"
            android:focusableInTouchMode="true"
            android:marqueeRepeatLimit="marquee_forever"
            android:singleLine="true"
            android:text="@string/long_txt" />
    
    
    </ScrollView>

  • 相关阅读:
    插入排序
    选择排序
    二分法查找
    pickle模块的使用
    循环和递归求阶乘、递归实现汉诺塔程序、递归实现拆出每个位的数字放在列表中、递归求第五个人的年龄
    app测试和测试基础
    TCP协议中的三次握手和四次挥手及其他
    AcWing 122 糖果传递
    AcWing 121 赶牛入圈 (二分+离散化)
    AcWing 120 防线 (二分)
  • 原文地址:https://www.cnblogs.com/my-love-is-python/p/14515139.html
Copyright © 2011-2022 走看看