定制圆角EditText与圆角Button
来源:互联网 发布:淘宝刷手会被坐牢吗 编辑:程序博客网 时间:2024/06/10 01:11
因为美观需要,需要定制一些圆角的Button,EditText,像下面这样
本渣对这种东西就是没啥美感,既然老大要求,那就学习了一下
首先
当然是先把EditText这个东西给写出来
EditText
<EditText android:layout_marginLeft="10dp" android:layout_width="match_parent" android:layout_height="40dp" android:hint="陈同学" android:background="@drawable/edittextsharp"/>
Button
<Button android:id="@+id/logIn_btn_WebLogin" android:layout_width="300dp" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_gravity="center_horizontal" android:background="@drawable/buttonsharp" android:text="微博登陆(WebView)" android:textAllCaps="false" android:textColor="@android:color/white" />
然后
有没有注意到我用的背景backgrou是@drawable里的资源,没错,确实是在@drawable里面做文章,在drawable文件夹目录->new->drawable resource file,代码如下
edittextsharp
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <!--里面空间的属性--> <solid android:color="#e2e2e2" > </solid> <!--圆角的半径--> <corners android:radius="3dp"> </corners> <!--边的属性--> <stroke android:color="@color/colorPrimary" android:width="2dp"> </stroke> <!--控制文字与边框的距离--> <padding android:left="5dp" android:right="5dp" android:bottom="5dp" android:top="5dp"></padding></shape>
buttonsharp
<?xml version="1.0" encoding="utf-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <solid android:color="@color/colorPrimaryDark"> </solid> <corners android:radius="5dp"> </corners></shape>
最后
运行一下,没毛病的话应该像上面那样,有毛病的话我也不知道
0 0
- 定制圆角EditText与圆角Button
- 使用shape自定义圆角样式的Button和EditText
- Button---圆角的Button
- 圆角与正圆形的Button
- android button 圆角与点击效果
- 设置button的圆角与 阴影
- 设置圆角EditText
- EditText设置圆角
- EditText设置圆角
- button 圆角设置
- 圆角的Button
- 自定义圆角button
- EditText与TextView和BUtton结合使用
- ListView与CheckBox,EditText,Button结合
- 编辑框EditText与按钮Button
- EditText,Button
- 圆角定制,定制四周圆角边框
- edittext特效之圆角
- kafka的安装与配置详解
- 软件错误与软件缺陷
- 历届试题 幸运数
- C++作业5
- Python_获得系统时间
- 定制圆角EditText与圆角Button
- ZOJ3947-Very Happy Great BG
- 567. Permutation in String Medium
- 项目应用中的卡尔曼滤波
- 感知哈希算法(Perceptual hash algorithm) 以图搜图
- 栈实现队列,队列实现栈
- 链表的增删查找
- Goroutine 的调度
- 不求甚解之自制编程语言