xml布局内容总结(三)--Android
关于xml中经经常使用到边框及边框效果,在此进行一下总结。
3.border(边框及边框效果)
(1)直角边框线
<LinearLayout
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:orientation="vertical"
android:background="@drawable/border_c"
>
</LinearLayout>
border_c.xml
<?
xml version="1.0" encoding="utf-8"?
>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 填充颜色 -->
<solid android:color="@color/listitem_green" />
<!-- 边框宽度。颜色 -->
<stroke
android:width="0.1dp"
android:color="@color/black" />
<!-- 4个角度的弧度设置 -->
<corners
android:topLeftRadius="0.0dip"
android:topRightRadius="0.0dip"
android:bottomLeftRadius="0.0dip"
android:bottomRightRadius="0.0dip"
/>
</shape>
(2)圆角边框线
<LinearLayout
android:layout_width="200dp"
android:layout_height="30dp"
android:layout_margin="10dp"
android:orientation="vertical"
android:background="@drawable/border_s"
>
</LinearLayout>
border_s.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- 填充颜色 -->
<solid android:color="@color/yellow" />
<!-- 边框宽度,颜色 -->
<stroke
android:width="0.1dp"
android:color="@color/black" />
<!-- 4个角度的弧度设置 -->
<corners
android:topLeftRadius="10.0dip"
android:topRightRadius="10.0dip"
android:bottomLeftRadius="10.0dip"
android:bottomRightRadius="10.0dip"
/>
</shape>
(3)横线,竖线
<TextView
android:layout_width="200dp"
android:layout_height="0.5dp"
android:background="@color/black"
/>
<TextView
android:layout_marginTop="10dp"
android:layout_width="0.5dp"
android:layout_height="50dp"
android:background="@color/black"
/>
(4)button效果
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/btn_style_green"
android:text="Button"
android:textColor="@color/white"
/>
btn_style_green.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_green_bg" android:state_pressed="true"/>
<item android:drawable="@drawable/button_blue_bg" android:state_focused="false" android:state_pressed="false"/>
</selector>
button_green_bg.xml
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/green" />
<stroke android:width="0.5dip" android:color="@color/black" />
<corners android:topLeftRadius="5.0dip" android:topRightRadius="5.0dip" android:bottomLeftRadius="5.0dip" android:bottomRightRadius="5.0dip" />
</shape>
button_blue_bg.xml
<?
xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/blue" />
<stroke android:width="0.5dip" android:color="@color/black" />
<corners android:topLeftRadius="5.0dip" android:topRightRadius="5.0dip" android:bottomLeftRadius="5.0dip" android:bottomRightRadius="5.0dip" />
</shape>
正常状态:
点击:
xml布局内容总结(三)--Android的更多相关文章
- xml布局内容总结(一)--Android
关于安卓项目中xml的使用非常多.为了达到一些好的UI效果.须要对xml比較熟练.会使用非常多的小技巧,本人准备对这些小技巧进行整理和总结,希望进行分享和交流. 关于weight的使用,因为weigh ...
- xml布局内容总结(四)--Android
(1)对于xml编写界面较复杂的情况下,使用include会使得编写和查看更清楚 <LinearLayout android:layout_width="mat ...
- 通过在xml布局文件中设置android:onClick=""来实现组件单击事件
在布局中出现android:onClick=""语句: <Button android:id="@+id/call_button" android:onC ...
- android xml布局文件属性说明
android xml布局文件属性说明 [摘]android xml布局文件属性说明 LinearLayout和RelativeLayout 共有属性:java代码中通过btn1关联次控件androi ...
- android 开发 使用自定义布局实现标题栏复用(标题栏内容自定义:使用代码实现和xml布局自定义属性2种办法实现)
在个人学习的情况下可能很少使用自定义布局去实现大量复用的情况下,但是在一个开发工作的环境下就会使用到大量复用的自定义控件. 实现思维: 1.写一个xml的布局,用于标题栏的样式,并且添加在标题栏中你想 ...
- Android中measure过程、WRAP_CONTENT详解以及 xml布局文件解析流程浅析
转自:http://www.uml.org.cn/mobiledev/201211221.asp 今天,我着重讲解下如下三个内容: measure过程 WRAP_CONTENT.MATCH_PAREN ...
- Android中点击按钮获取string.xml中内容并弹窗提示
场景 AndroidStudio跑起来第一个App时新手遇到的那些坑: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/103797 ...
- Android中将xml布局文件转化为View树的过程分析(下)-- LayoutInflater源码分析
在Android开发中为了inflate一个布局文件,大体有2种方式,如下所示: // 1. get a instance of LayoutInflater, then do whatever yo ...
- Android开发 ---xml布局元素
1.android:orientation="vertical/horizontal" vertical为垂直布局, horizontal为水平布局 2.android:layou ...
随机推荐
- [bzoj1012](JSOI2008)最大数maxnumber(Fenwick Tree)
Description 现在请求你维护一个数列,要求提供以下两种操作: 1. 查询操作.语法:Q L 功能:查询当前数列中末尾L个数中的最大的数,并输出这个数的值.限制:L不超过当前数列的长度. 2. ...
- 2016. 4.10 NOI codevs 动态规划练习
1.codevs1040 统计单词个数 1040 统计单词个数 2001年NOIP全国联赛提高组 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 De ...
- stream_get_meta_data(打开的文件句柄) 拿到任何网站服务器名字,从封装协议文件指针中取得报头/元数据
$url = "http://www.sina.com/"; function parse($url) { if(!($fp = @fopen($url, 'rb')) ){ ex ...
- HDU 1864 Brave Game 【组合游戏,SG函数】
简单取石子游戏,SG函数的简单应用. 有时间将Nim和.SG函数总结一下……暂且搁置. #include <cstdio> #include <cstring> #define ...
- 嵌入式学习之Nand Flash
转:http://m.blog.csdn.net/blog/woshixiongge/9017149 Nand Flash是flash存储器的一种,其内部采用非线性宏单元模式,为固态大容量内存的实现提 ...
- text-align 属性,输入框数字向右靠
1.业务需求:金额输入框数字向右靠 2.HTML文件 <td id="otherPay_Td"> <input id="otherPay" t ...
- 又学到一个词REPL
A read–eval–print loop (REPL), also known as an interactive toplevel or language shell 指的是 交互式解释器.
- Cannot generate SSPI context
请在参考如下文章前,重启服务器解决! 相信我 没错的! http://support.microsoft.com/kb/811889
- 用户手册是Yasm汇编
本文档的用户手册是Yasm汇编. 它是介绍和通用所有Yasm用户参考. 英文的参考:http://www.cnblogs.com/coryxie/p/3959888.html 1 .介绍 Yasm b ...
- 网页图表控件Highcharts选项配置参数
Highcharts提供大量的选项配置参数,您可以轻松定制符合用户要求的图表,目前官网只提供英文版的开发配置说明文档,而中文版的文档网上甚少,且零散不全.这里,我把Highcharts常用的最核心的参 ...