Git Product home page Git Product logo

lsettingview's Introduction

LSettingView

设置界面条目封装,同时包含:

  • 设置左侧图标
  • 设置左侧文字
  • 设置右侧图标
  • 设置右侧图标是否显示
  • 设置右侧为复选框样式
  • 设置右侧为开关模式
  • 设置右侧文字及样式

新增设置

  • 设置左侧图标大小
  • 设置左侧图标和文字间距
  • 代码动态更改左侧文字
  • 代码动态更改右侧文字
  • 复选框和切换按钮模式下增加选中状态监听

运行效果:

效果1 效果2 效果3 效果4 效果5 效果6

快速使用

1. 添加依赖

compile 'com.leon:lsettingviewlibrary:1.4.0'

2. 在布局文件中引用

<com.leon.lib.settingview.LSettingItem
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/item_one"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    leon:leftIcon="@drawable/history"
    leon:leftText="我的消息"/>

3. 添加单击事件处理

LSettingItem mSettingItemOne = (LSettingItem) findViewById(R.id.item_one);
mSettingItemOne.setmOnLSettingItemClick(new LSettingItem.OnLSettingItemClick() {
            @Override
            public void click(boolean isChecked) {
                Toast.makeText(getApplicationContext(), "我的消息", Toast.LENGTH_SHORT).show();
            }
        });
 //更改左侧文字       
mSettingItemOne.setLeftText("左侧文字");
//更改右侧文字
mSettingItemOne.setRightText("右侧文字");

自定义属性

方法说明

属性 说明 类型
leftText 左侧文字 string
leftIcon 左侧图标 integer
rightIcon 右侧图标 integer
textSize 左侧文字大小 dimension
textColor 左侧文字颜色 color
isShowUnderLine 是否显示底部分割线 boolean
rightStyle 右侧图标风格 enum
isShowRightText 是否显示右侧文字 boolean
rightText 右侧文字 string
rightTextSize 右侧文字大小 boolean
rightTextColor 右侧文字颜色 color
leftIconSize 左侧图标大小 dimension
leftTextMarginLeft 左侧图标与文字间距 dimension

右侧图标风格

  • iconShow 显示图标
  • iconHide 隐藏图标
  • iconCheck 显示复选框
  • iconSwitch 显示切换开关

如果本库对你有用,欢迎star或者fork! 欢迎访问 博客 查看更多文章。

lsettingview's People

Contributors

leonhua avatar limuyang2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.