Android使用shape使组件呈现出特殊效果的方法
作者:Central-Perk 发布时间:2022-06-28 03:42:27
标签:Android,shape,组件
本文实例讲述了Android使用shape使组件呈现出特殊效果的方法。分享给大家供大家参考,具体如下:
使用到的布局文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#ffffff"
android:gravity="center_horizontal">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="未使用效果"
android:layout_marginTop="30dp"
/>
<EditText
android:id="@+id/edit"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="未使用效果 未使用效果 未使用效果 未使用效果 未使用效果 未使用效果"
android:cursorVisible="true"
/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="使用效果"
android:layout_marginTop="10dp"
/>
<EditText
android:id="@+id/edit2"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:textColor="#000000"
android:text="使用效果 使用效果 使用效果 使用效果 使用效果 使用效果 使用效果 使用效果"
android:background="@drawable/shape"
android:cursorVisible="true"
/>
</LinearLayout>
使用到的shape文件
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<corners
android:radius="10dp"
/>
<gradient
android:startColor="#33CC00"
android:endColor="#666600"
android:angle="45"
/>
<padding
android:left="5dp"
android:top="5dp"
android:right="5dp"
android:bottom="5dp"
/>
<stroke
android:width="3dp"
android:color="#FF3300"
/>
</shape>
在这里主要说一下shape文件中各项的功能
gradient主要设置背景颜色渐变。startColor为起始颜色值,endColor为结束颜色值,angle为渐变角度
padding主要设置组件里内容距离组件内边框的间距
stroke主要设置组件的边框。width为边框宽度,color为边框颜色
希望本文所述对大家Android程序设计有所帮助。
0
投稿
猜你喜欢
- 最近做的一个项目涉及到文件上传与下载。前端上传采用百度webUploader插件。有关该插件的使用方法还在研究中,日后整理再记录。本文主要介
- 目录常用APIgeoaddgeoposgeodistgeoradiusbymembergeohash在外卖软件中的附近的美食店铺、外卖小哥的
- 本文实例讲述了C#使用foreach语句简单遍历数组的方法。分享给大家供大家参考。具体如下:using System;public clas
- 本文实例介绍了清除aspx页面缓存的程序实现方法,具体步骤如下:所有用到页面缓存的aspx页面修改以下cs,让它继承一个自定义基类(例如:P
- 1.Spring IOC容器可以管理bean的生命周期,Spring允许在bean生命周期内特定的时间点执行指定的任务。2.Spring I
- 1 本地调试介绍本地调试: 这里是指在开发环境中,部署了一整套的某个项目或者产品的服务,开发人员开发时,本地会起一个或多个服务,这些服务和开
- Thread-per-Message模式(这项工作就交给你了)当你很忙碌的时候,这个时候公司楼下有个快递,于是你委托你的同事帮你拿一下你的快
- 本文实例讲述了C#控件闪烁的解决方法。分享给大家供大家参考。具体分析如下:如果你在Form中绘图的话,不论是不是采用的双缓存,都会看到图片在
- 图形验证码属于老生常谈了,具体细节这里就不说了。生成图形验证码的办法非常多,今天讲解一种通过Kaptcha组件快速生成图形验证码的方法。Ka
- using System;using System.Collections.Generic;using System.Text;using
- ComparableComparable 是排序接口。若一个类实现了Comparable接口,就意味着“该类支持排序”。 即然实现Compa
- 一.什么是maven?Maven是一个项目管理工具,它包含了一个项目对象模型 (Project Object Model),一组标准集合,一
- 本文实例为大家分享了C#强制转换和尝试转换的方法,供大家参考,具体内容如下将String[]类型的Object类型,转换为String[]类
- 一、分布式锁介绍分布式锁主要用于在分布式环境中保护跨进程、跨主机、跨网络的共享资源实现互斥访问,以达到保证数据的一致性。二、架构介绍&nbs
- 1.char数组(字符数组)->字符串可以通过:使用String.copyValueOf(charArray)函数实现。举例:char
- 在进行一个表达式的计算时,先将表达式分割成数字和字符串然后利用出入栈将分割后的表达式进行中缀转后缀,再将后缀表达式进行计算得到结果(思想在上
- 1.文件页面编码导致的乱码。每一个文件(java,js,jsp,html等)都有其本身的编码格式,文件中的代码在一种编码中显示正常,在另外一
- 简介DataBinding 是 Jetpack 组件之一,适用于 MVVM 模式开发,也是Google官方推荐使用的组件之一。使用DataB
- 实例如下:using System;using System.Linq.Expressions;class DynamicPredicate
- 目录微服务微服务架构SpringCould简介环境搭建1. 创建数据库2. 新建一个子模块api3. 新建一个子模块provider作为服务