zoukankan      html  css  js  c++  java
  • textEdit

    textEdit可以添加背景图片、渐变色、文字颜色、大小等等

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            tools:context=".MainActivity">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical"
        >
            <!--设置字号为20pt,在文本末尾绘制图片-->
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Hello World!"
                android:textSize="20pt"
                android:drawableEnd="@mipmap/ic_launcher"
                android:drawableRight="@mipmap/ic_launcher"
            />
            <!--设置中间省略,所有字母大写-->
            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:singleLine="true"
                    android:ellipsize="middle"
                    android:textAllCaps="true"
                    android:text="学习Android学习Android学习Android学习Android学习Android学习Android学习Android"
            />
            <!--设置文字颜色、大小、使用阴影-->
            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="测试文字"
                    android:shadowColor="#00f"
                    android:shadowDx="10.0"
                    android:shadowDy="8.0"
                    android:shadowRadius="3.0"
                    android:textColor="#ff0"
                    android:textSize="18pt"
            />
            <!--设置可勾选文本-->
            <CheckedTextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="可勾选的文本"
                    android:checkMark="@drawable/ok"
            />
            <!--指定背景-->
            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="带边框的文本"
                    android:textSize="24pt"
                    android:background="@drawable/bg_border"
            />
            <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="圆角边框,渐变背景"
                    android:textSize="24pt"
                    android:background="@drawable/bg_border2"
            />
        </LinearLayout>
    </ScrollView>
    activaty_main.xml
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
            android:shape="rectangle">
    <!--设置背景色为透明-->
        <solid android:color="#0000"/>
        <!--设置红色边框-->
        <stroke android:width="2dp" android:color="#f00"/>
    </shape>
    bg_border
    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
           android:shape="rectangle">
      <!--指定4个圆角的半径-->
        <corners
                android:topLeftRadius="20dp"
                android:topRightRadius="10dp"
                android:bottomLeftRadius="20dp"
                android:bottomRightRadius="10dp"
        />
        <!--指定边框线条的宽度和颜色-->
        <stroke
            android:color="#f0f"
            android:width="4px"/>
        <!--指定渐变色-->
        <gradient
            android:startColor="#f00"
            android:centerColor="#0f0"
            android:endColor="#00f"
            android:type="sweep"/>
    </shape>
    bg_border2
  • 相关阅读:
    Codeforces Round #281 (Div. 2) A. Vasya and Football(模拟)
    自动生成代码工具
    导入导出维护计划
    收集错误日志方法
    C#常用控件和属性
    人民币转换
    身份证验证
    设置下拉列表项的默认值
    清除维护任务
    清除MSSQL历史记录
  • 原文地址:https://www.cnblogs.com/superxuezhazha/p/11474547.html
Copyright © 2011-2022 走看看