Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Repository files navigation

SettingView

现在市面上许多应用在个人中心或者设置中心都有条目,每次都会写这些无用的代码,所以做了一个简单的组合控件,简单省时,方便开发.

先上图

快速使用

1.添加依赖
compile 'com.jeff:settingitem:1.0'
2.在布局文件中引用
<com.jeff.settingitem.SettingView
        android:layout_width="match_parent"
        android:layout_height="44dp"
        app:item_background="@drawable/selector_item"
        app:item_text="消息"
        app:left_icon="@mipmap/icon_per_infor"
        app:show_dot="true"
        app:text_size="16sp" />
3.添加点击事件
SettingView mItem = (SettingView) findViewById(R.id.setting);
        mItem.setOnItemViewClick(new SettingView.OnItemViewClick() {
            @Override
            public void itemClick() {
                //do something
            }
        });
4.对外提供设置方法
mItem.setItemText("消息");    //设置条目文字
mItem.showDot(false);       //是否显示红点
mItem.showRightIcon(true);      //是否显示右边icon
mItem.showLeftIcon(true);       //是否显示左边icon
5.xml中的自定义属性
属性 说明 类型
item_text 条目文字 string
item_background 条目背景 reference
left_icon 左侧图标 reference
right_icon 右侧图标 reference
text_size 文字大小 dimension
text_color 文字颜色 color
show_left_icon 是否显示左侧图标(默认显示) boolean
show_right_icon 是否显示右侧图标(默认显示) boolean
show_dot 是否显示小红点(默认不显示) boolean
left_icon_margin_left 左侧图标距离左边margin dimension
text_margin_left 文字距离左边图标margin dimension
right_icon_margin_right 右侧图标距离右边margin dimension

欢迎大家star,有什么问题可以issue.欢迎访问我的博客 查看更多文章。

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.