# RTextView **Repository Path**: 632835821/RTextView ## Basic Information - **Project Name**: RTextView - **Description**: 基于TextView 1.直接设置selector背景2.直接设置drawableLeft大小 3.圆角,圆形,背景/边框/文字根据状态变色 - **Primary Language**: Android - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 17 - **Forks**: 1 - **Created**: 2017-09-18 - **Last Updated**: 2024-10-23 ## Categories & Tags **Categories**: android-modules **Tags**: None ## README # RTextView ## 欢迎使用 RTextView ### 1.特点 > 1. RTextView 让你从此不再编写和管理大量 selector 文件(这个太可恨了) > > 2. RTextView 改造了 drawableLeft/drawableXXX 图片的大小,从此你不在需要使用 LinearLayout + ImageView + TextView 就能够直接实现文字带图片的功能,关键还能设置icon大小 > > 3. RTextView 能够直接设置各种圆角效果: 四周圆角,某一方向圆角,甚至椭圆,圆形都简单实现。 边框效果,虚线边框都是一个属性搞定 > > 4. RTextView 不仅能够定义默认状态的背景,边框,连按下/点击状态通通一起搞定 > > 5. RTextView 按下变色支持:背景色,边框,文字,drawableLeft/xxx (这个赞啊) ### 2.效果图 > 示例效果图,不限于如此,更多使用详细参考相关属性 ![](corner.png) ![](state.gif) ### 3.属性说明 > 开发者根据实际需要选择使用对应的功能属性 | 属性 |说明 | | ------------- | :-------------| | corner_radius | 圆角 四周 | | corner_radius_top_left | 圆角 左上 | | corner_radius_top_right | 圆角 右上 | | corner_radius_bottom_left | 圆角 左下 | | corner_radius_bottom_right | 圆角 右下 | | border_dash_width | 虚线边框 宽度 | | border_dash_gap | 虚线边框 间隔 | | border_width_normal | 边框宽度 默认 | | border_width_pressed | 边框宽度 按下 | | border_width_unable | 边框宽度 不可点击 | | border_color_normal | 边框颜色 默认 | | border_color_pressed | 边框颜色 按下 | | border_color_unable | 边框颜色 不可点击 | | background_normal | 背景颜色 默认 | | background_pressed | 背景颜色 按下 | | background_unable | 背景颜色 不可点击 | | text_color_normal | 文字颜色 默认 | | text_color_pressed | 文字颜色 按下 | | text_color_unable | 文字颜色 不可点击 | | icon_src_normal | drawable icon 默认 | | icon_src_pressed | drawable icon 按下 | | icon_src_unable | drawable icon 不可点击 | | icon_height | drawable icon 高 | | icon_width | drawable icon 宽 | | icon_direction | drawable icon 位置{left,top,right,bottom} | ### 4.使用 > ### 4.1 Gradle (版本号根据更新历史使用最新版) compile 'com.ruffian.library:RTextView:1.0.0' > ### 4.2 XML使用 > ### 4.3 以上属性均提供Java代码 get/set 方法 RTextView textView=(RTextView) findViewById(R.id.text1); //set... textView.setIconNormal(getDrawable(R.mipmap.ic_launcher)) .setIconHeight(10) .setIconWidth(20) .setIconDirection(RTextView.ICON_DIR_TOP); //get... int iconHeight=textView.getIconHeight(); ### 5.版本历史 **v1.0.0** `2017.09.07` 发布第一版本