zoukankan      html  css  js  c++  java
  • android shape 的使用

    做个笔记,只是为了自己用的时候好找。

    background.xml

    <?xml version="1.0" encoding="utf-8"?>
    <!-- 默认为方形 可用android:shape调节形状 -->
    <shape xmlns:android="http://schemas.android.com/apk/res/android" >
        <!--颜色渐变   angle为渐变角度-->
        <gradient
            android:startColor="#FFD63DB7"
            android:endColor="#FF72CAE1"
            android:angle="90"  
            >
        </gradient>
        <!-- 设置圆角   -->
    	<corners android:radius="30dp"></corners>
    	
    	<!-- 内边距 -->
    	<padding android:top="20dp"></padding>
    	
    	<!-- 实心  就是填充的意思-->
    	<!-- <solid ></solid> -->
    	
    	<!-- 描边 -->
    	<stroke android:width="3dp" android:color="#5525B141"></stroke>
    </shape>
    

    布局里面调用

    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:context=".MainActivity" 
        android:background="@drawable/background">
    
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="测试" >
    
            </TextView>
    
        
    
    </RelativeLayout>
    

    效果图

    做的漂亮点可以直接替代图片。省app的大小了

  • 相关阅读:
    函数
    A × B problem
    求n的阶乘
    自己构建一个vector函数
    int与string的互相转化
    列一列(斐波那契数列)
    找一找
    c++大数计算模板
    JSON--js中 json字符串转对象、对象转字符串
    JSON
  • 原文地址:https://www.cnblogs.com/tangchd/p/3459109.html
Copyright © 2011-2022 走看看