Android使用shape使组件呈现出特殊效果的方法

Android使用shape使组件呈现出特殊效果的方法,第1张

概述本文实例讲述了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相关内容感兴趣的读者可查看本站专题:《Android开发入门与进阶教程》、《Android布局layout技巧总结》、《Android视图View技巧总结》、《Android编程之activity *** 作技巧总结》、《Android *** 作json格式数据技巧总结》、《Android资源 *** 作技巧汇总》及《Android控件用法总结》

希望本文所述对大家AndroID程序设计有所帮助。

总结

以上是内存溢出为你收集整理的Android使用shape使组件呈现出特殊效果的方法全部内容,希望文章能够帮你解决Android使用shape使组件呈现出特殊效果的方法所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1145704.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-31
下一篇 2022-05-31

发表评论

登录后才能评论

评论列表(0条)

保存