android 自定义控件样式点击效果实现

Xml 文件作用类型:放到drawable文件夹内

ButtonCheckBox,ImageView TextView Layoutselector 设置

对于Button,设置background

对于ImageView 设置src,setImageResource

对于CheckBox 设置 background

android:background="@drawable/checkbox_my_recording"

或者 设置 style

style="@style/sensor_lock_checkbox"

style 内指定对应的selector xml 文件

对于TextView,设置 textColor

android:textColor="@drawable/mainfrag_tabhost_txt_style"

对于Layout,设置 background

state_pressed

state_focused

state_selected

state_enabled

和正常状态

 

 

动画

animation-list

根标签为animation-list,其中oneshot代表着是否只展示一遍,设置为false会不停的循环播放动画
根标签下,通过item标签对动画中的每一个图片进行声明
android:duration 表示展示所用的该图片的时间长度

 

Shape

<solid android:color= "#fafff1" />
<stroke
    android:width= "1dp"
    android:color= "#83db00" 
/>
<corners
    android:radius="1dp" 
/>

通过background 设置,设置给layout,对话框

android:background="@drawable/dialog_activity_bg"

 

定义 corner

 

layer-list

进度条样式

android:progressDrawable="@drawable/download_progressbar"

download_progressbar.xml

 

RatingBar

android:progressDrawable="@drawable/popup_ratingbar_config_small"

popup_ratingbar_config_small.xml

 

rotate

旋转

pull_refresh_process_bar.xml

 

光标样式

edit_cusor_style.xml

EditText中设置

android:textCursorDrawable="@drawable/edit_cusor_style"

 

ListView 选中项样式,自定义Item 的布局,在该布局xml 中设置background

livetv_channel_item_selector.xml


宽度,高度设置在dimen文件中

android:layout_width="@dimen/corner_width"
android:layout_height="@dimen/corner_height"

<dimen name="corner_width">55dp</dimen>
<dimen name="corner_height">20dp</dimen>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值