my-love-is-python

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>

分类:

技术点:

相关文章:

  • 2021-11-17
  • 2021-12-11
  • 2021-11-28
  • 2021-07-26
  • 2022-02-04
  • 2021-12-23
  • 2021-05-17
猜你喜欢
  • 2021-06-27
  • 2021-06-09
  • 2021-09-17
  • 2022-01-18
  • 2021-12-02
  • 2022-02-06
相关资源
相似解决方案