设置边框圆角可以在drawable-mdpi目录里定义一个xml:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#000000" />
<corners android:topLeftRadius="10dp"
android:topRightRadius="10dp"
android:bottomRightRadius="10dp"
android:bottomLeftRadius="10dp"/>
</shape>
解释:solid的表示填充颜色,为了简单,这里用的是黑色。
而corners则是表示圆角,注意的是这里bottomRightRadius是左下角而不是右下角,bottomLeftRadius右下角。
当然上面的效果也可以像下面一样设置,如下:
<corners android:radius="5dp" />
如果想引用这个xml,只需要@drawable/corners_bg.xml即可:
android:background="@drawable/corners_bg"
main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:background="#FFFFFF">
<RelativeLayout android:id="@+id/login_div"
android:layout_width="fill_parent" android:layout_height="150dip"
android:padding="15dip" android:layout_margin="15dip"
android:background="@drawable/corners_bg">
</RelativeLayout>
</LinearLayout>
运行结果:
- 大小: 14.3 KB
分享到:
相关推荐
Android ListView边框圆角美化,可以用来仿iphone的个别界面。相当有用。美观。
首先,在res下面新建一个文件夹drawable,在drawable下面新建三个xml文件:shape_corner_down.xml、shape_corner_up.xml和shape_corner.xml,分别是下面两个角是圆角边框,上面两个角是圆角边框,四个角全部是圆角...
自定义TextView带边框,可以动态更边框颜色以及字体颜色,可设置边框圆角
RCImageView 自定义圆角ImageView,带边框效果
android 圆角图标 和不规则圆角(边框)
首先我将贴出几种实现圆角边框的dmeo程序效果图: 方式一:使用shape元素填充背景,设置圆角/带弧度的角 1、首先在 \res\drawable下新建Shape为根元素的资源文件:corners_bg.xml, 代码如下: <?xml version=...
对初学者理解android 的tabactivity+listview+边框圆角+相机调用 应该有点帮助吧
Android为ListView添加圆角边框效果,安卓UI设计的例子,默认情况下ListView的外框是直角的,也就是大家习惯的样式,但为了美化更突出,或者与你的应用风格更吻合,有时候可能修饰成圆角边框,本例子就是实现了这一...
android中实现ImageView圆角图片,效果换是不错
圆形,圆角,带边框的圆形imageView,以及白色边框的圆形imageview
android圆角图片,支持自定义边框颜色,及边框的大小。需要的可以下载
可设置圆角背景边框的的按钮 通过调节色彩明度自动计算按下(pressed)状态颜色 Gradle repositories { maven { url "https://jitpack.io" } } dependencies { compile 'com.github.czy1121:roundbutton:1.1.0' ...
设置边框圆角可以在drawable-mdpi目录里定义一个xml: <?xml version=1.0 encoding=utf-8?> <shape xmlns:android=http://schemas.android.com/apk/res/android> <solid android:color=#000000> <corners...
android 圆角图标 和不规则圆角(边框.zip,太多无法一一验证是否可用,程序如果跑不起来需要自调,部分代码功能进行参考学习。
NULL 博文链接:https://mft.iteye.com/blog/2357031
Android Studio 实现对话框圆角,毛玻璃模糊效果
Android设置虚线、圆角、渐变,详情请链接至: http://blog.csdn.net/lan410812571/article/details/9946991
android中设置EditText有四周边框,圆角边框。将此文件放到res/drawable/edittext.xml,在布局文件中给EditText添加属性android:background="@drawable/edittext"。效果完美实现。当然,里面的圆角,颜色可根据自己...
主要介绍了Android编程实现圆角边框布局效果的方法,结合实例形式分析了Android TableLayout布局的相关属性操作与圆角边框实现技巧,需要的朋友可以参考下
Android自定义Iphone风格的圆角边框开关按钮,用xml实现,无图片资源