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 ...
随机推荐
- 星际争霸 虚空之遗 人族5BB 操作流程
人族5BB rush timing 3min-3min30 一波战术,对面双开不侦察应该就GG了. 14农民BS,建议在第一个BS后的100矿,马上接上一个BS堵口,基本上对面是侦察不到的,特别是内双 ...
- rman catalog配置简要笔记
服务端配置: SQL> create tablespace tbs_rman datafile 'H:\oradata\test\tbs_rman.dbf' size 20m autoexten ...
- Multivariate Adaptive Regression Splines (MARSplines)
Introductory Overview Regression Problems Multivariate Adaptive Regression Splines Model Selection a ...
- 【Tomcat】Tomcat闪退的问题解决/Tomcat修改端口号无效
一. Tomcat闪退的问题解决 1.首先 确定JDK的环境变量配置正确 2.下载纯净的新的Tomcat 3.在bin\startup.bat文件中的第一行前面加入: SET JAVA_HOME = ...
- Android Parcel对象详解
关于Parcel的使用 在分析Parcel之前,首先按照分析流程,介绍下关于Parcel的相关常规使用. 首先是关于Parcel的获取: Parcel parcle = Parcel.Obtain() ...
- 《Go语言实战》笔记之第三章 ----包
原文地址: http://www.niu12.com/article/10 ####包 所有的.go 文件,除了空行和注释,都应该在第一行声明自己所属的包. 每个包都在一个单独的目录里. 不能把多个包 ...
- OpenCV腐蚀与膨胀(Eroding and Dilating)
腐蚀与膨胀(Eroding and Dilating) 目标 本文档尝试解答如下问题: 如何使用OpenCV提供的两种最基本的形态学操作,腐蚀与膨胀( Erosion 与 Dilation): ero ...
- OpenWRT DNS无法解析WAN连接的内网服务器域名
系统版本OpenWrt Chaos Calmer 15.05.1,网络连接为:WAN口连接内网10.x.x.x网段,WAN口设置为静态IP.设置L2TP接口,通过L2TP访问外网.问题出现于,所有外网 ...
- 自定义标签(JspFragment类、invoke方法、开发带属性的标签)
自定义标签(JspFragment类.invoke方法.开发带属性的标签) 一.JspFragment类 javax.servlet.jsp.tagext.JspFragment类是在JSP2.0中定 ...
- LInux 分割合并文件
有两种方式, 第一种使用dd命令 第二种使用split dd命令是linux下一个非常有用的磁盘命令.它可以将指定大小的块拷贝成一个文件,并在拷贝的同时执行指定的转换.UNIX已经提供了文件切割功能, ...