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
  • 相关阅读:
    Oracle常见授权与回收权限——grant和revoke
    数据库之笛卡尔积
    hdu 2032 一维数组实现杨辉三角
    poj3071之概率DP
    冒泡排序及两种优化方式
    Non-ASCII character &#39;xe8&#39; in file xxx.py on line 8, but no encoding declared
    编写shell脚本获取本机的网络地址。&#160; 比方:本机的ip地址是:192.168.100.2/255.255.255.0,那么它的网络地址是&#160;192.168.100.1/255.255.255.
    移动站点性能优化
    Math类概述及其成员方法
    java中StringBuilder、StringBuffer、String类之间的关系
  • 原文地址:https://www.cnblogs.com/superxuezhazha/p/11474547.html
Copyright © 2011-2022 走看看