Android自定义矩形及selector、shape的使用

本文详细介绍了Android中selector和shape的使用,包括点击时背景颜色的处理,以及自定义矩形的属性解读,如圆角、描边和填充等。通过实例展示了如何在xml布局文件中应用这些技术,以实现不同状态下的视图效果。
摘要由CSDN通过智能技术生成

【声明】转载请注明出处,此文出自指尖飞落的博客:http://blog.csdn.net/huntersnail

——每天写一篇博客,每天做一点技术积累!


Android自定义矩形及selector、shape的使用

由于项目开发需要,以前虽然用过selector、shape但是都没有好好去研究过,只知道用,不知道它们的属性具体有哪些作用。虽然网上一查就都知道了,感觉还是要自己去弄懂一下。

下面咱们一起去研究下:


一、xml布局文件

/测试Demo/res/layout/check_box.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/order_meth"
        style="@style/style_padding"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:background="@drawable/selector_mine"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="wrap_content&#
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值