幸福别等,世事别怕!
ruffianzhong / rwidgethelper Goto Github PK
View Code? Open in Web Editor NEWAndroid UI 快速开发,专治原生控件各种不服
Android UI 快速开发,专治原生控件各种不服
能加个setselect选中吗?加上选中状态就完美了
能加个setselect选中吗?加上选中状态就完美了
能加个setselect选中吗?加上选中状态就完美了
现在缺一个选中状态
一个非常棒的库 ,能够如果加上实时预览就更好了,Android 编译时间又长不能实时预览是一件很麻烦的事
大佬你好,这里有一点点小小的建议,大佬在命名自定义属性名称的时候,可不可以在常见的类似“icon_width”这种通用名称前面加个前缀啊,因为在集成其他第三方库的时候基本都会用到这种名字,就会导致aapt编译出错,对一个刚入门的萌新来讲,aapt这种问题真的要搞爆炸了……
我用这个控件的时候 用的最多的是state_focus状态
RImageView设置corner_radius后scaleType属性无效
`
<com.ruffian.library.widget.RFrameLayout
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_marginHorizontal="10dp"
android:layout_marginTop="10dp"
app:corner_radius="10dp"
app:background_normal="@android:color/holo_blue_bright"
android:clipChildren="true">
<cn.bingoogolapple.bgabanner.BGABanner
android:id="@+id/banner_home"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:banner_pointTopBottomMargin="10dp"
app:banner_transitionEffect="defaultEffect"
app:banner_pointContainerBackground="@android:color/transparent"
app:banner_pageChangeDuration="1000"
app:banner_pointAutoPlayInterval="5000"
android:scaleType="fitXY"/>
</com.ruffian.library.widget.RFrameLayout>
`
如代码,父组件com.ruffian.library.widget.RFrameLayout,设置圆角,子组件BGABanner未设置圆角,但是直角覆盖了父组件了,设置了clipChildren也无效,希望超出部分不显示,让子组件也在圆角里。
赞👍
你好。我现在有个功能,输入框在输入数值以后,自动后后面补一个对应的长度单位会速度单位,我是通过icon相关的几个属性来显示单位的,但是设置的hint有点长,输入数字后,数值和单位中间有很大的空隙,请问这个BUG怎么解决?
<com.sportq.fit.common.utils.superView.RLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
app:background_normal="@color/white"
app:corner_radius="8.0dip">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:backgroud="@color/color_313131">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15.0dip"
android:textColor="@color/white"
android:textSize="18.0sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="18.0dip"
android:layout_marginLeft="28.0dip"
android:layout_marginRight="28.0dip"
android:layout_marginTop="4.0dip"
android:textColor="@color/color_c8c8c8"
android:textSize="12.0sp" />
</LinearLayout>
<LinearLayout
android:id="@+id/exist_cause_linear"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" />
</com.sportq.fit.common.utils.superView.RLinearLayout>
这样布局,在dialog里面显示时,上面的圆角就没有了 是什么情况啊?
用了最新版本的阴影功能,列表滑动很卡,已经确认是阴影的问题,去掉就好了,希望修复,这个阴影功能确实很实用,希望修复
java.lang.IllegalArgumentException: Software rendering doesn't support hardware bitmaps
at android.graphics.BaseCanvas.onHwBitmapInSwMode(BaseCanvas.java:550)
at android.graphics.BaseCanvas.throwIfHwBitmapInSwMode(BaseCanvas.java:557)
at android.graphics.BaseCanvas.throwIfCannotDraw(BaseCanvas.java:69)
at android.graphics.BaseCanvas.drawBitmap(BaseCanvas.java:127)
at android.graphics.Canvas.drawBitmap(Canvas.java:1504)
at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:545)
at com.ruffian.library.widget.helper.RImageViewHelper.drawBitmapSrc(RImageViewHelper.java:351)
at com.ruffian.library.widget.helper.RImageViewHelper.drawBitmap(RImageViewHelper.java:243)
at com.ruffian.library.widget.helper.RImageViewHelper.onDraw(RImageViewHelper.java:209)
at com.ruffian.library.widget.RImageView.onDraw(RImageView.java:34)
米8 crash
设置android:scaleType="fitXY" 引起的
设置centerCrop无问题
如题
如题
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'com.ruffian.library.widget.helper.RTextViewHelper com.ruffian.library.widget.RTextView.getHelper()' on a null object reference
at com.ruffian.library.demo.RTextViewActivity.onCreate(RTextViewActivity.java:35)
at android.app.Activity.performCreate(Activity.java:6355)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2440)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2547)
at android.app.ActivityThread.access$1100(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1398)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:157)
at android.app.ActivityThread.main(ActivityThread.java:5603)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:774)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:652)
XML直接加载gif图片似乎是不会动的,尺寸也出现了问题
public void setEnabled(boolean enabled) { super.setEnabled(enabled); mHelper.setEnabled(enabled); }
布局文件初始化的时候mHelper为空
public RTextView(Context context, AttributeSet attrs) { mHelper = new RTextViewHelper(context, this, attrs); super(context, attrs); }
是否应该先初始化mHelper?
这个兼容版本最低到多少啊
对于本库暂时没有的需求,可以在这里提出来,会根据大众需求酌情添加,完善本库
系统是4.4.2
希望再添加一种selected状态,这个状态也是比价常用的,另外这个任何一个view都有的属性
如果只设置border_width_normal和border_color_normal,不设置background_normal, border显示不出来
代码里现在只支持 颜色和颜色的数组 不支持图片资源吗
动态设置TextView的背景颜色的时候,不能正常显示
rTextView = view.findViewById(R.id.rtv_textView);
rTextView.getHelper().setBackgroundColorNormal(R.color.red);
代码设置一个RTextview的背景图片无效
iv1.helper.setBackgroundDrawableNormal(resources.getDrawable(R.mipmap.icon_progress_hl))
经查设置setStateBackgroundColor背景颜色是可以的,但是背景图片不行,
如果我的背景色是一张图片,怎么设置?
额
见下面代码:
<com.ruffian.library.widget.RImageView
android:id="@+id/feed_cover"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@null"
android:scaleType="centerCrop"
app:corner_radius="@dimen/size_8"
app:icon_src_normal="@mipmap/ic_split_graph" /> <-- 这里使用了默认本地图片
RequestOptions options = new RequestOptions()
.centerCrop()
.placeholder(R.mipmap.ic_split_graph)
.error(R.mipmap.ic_split_graph)
.diskCacheStrategy(DiskCacheStrategy.ALL);
ImageHolder h1 = (ImageHolder) holder;
mLoader.load(item.getCover()).apply(options).into(h1.mImageView);
之前一直在找能替代drawable的的控件,试了几种方式都不是很好,
https://github.com/JavaNoober/BackgroundLibrary 这种是全局替换的方式
https://github.com/duanhong169/DrawableToolbox 这种是KT动态设置的,都不是很理想。
我现在使用的是QMUIAndroid 的实现,但是这个可扩展性小,竟然没有点击状态的设置。
他们共同的有点就是侵入小。但是都有一些难以忍受的缺点。。所以选择了大佬的方式。
现在在大佬的基础上面加入了Ripple和渐变色的实现,都是一些比较简单的实践。有时间把阴影的实现加入。
总之感谢大佬了
当只设置了background_normal,没有设置background_pressed,
理应按下和默认的状态是一样的,但是目前是按下的时候会变白或者说看不见了....
导致每次写background_normal我都必须再写一个一样颜色的background_pressed
现xml格式 通过app:background_normal 可以设置
但代码上试了很多次不行
可否给个方法
<com.ruffian.library.widget.RTextView
android:id="@+id/iqiyi"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
app:icon_src_normal="@mipmap/qiyi"
android:textAlignment="center"
app:icon_height="40dp"
app:icon_width="40dp"
app:icon_direction="top"
android:text="爱奇艺"
android:onClick="goFilm"/>
请注意最后一行,把onClick事件写在xml里,在activity实现
public void goFilm(View view) {
//方法
}
出现崩溃了。
Could not find method goFilm(View) in a parent or ancestor Context for android:onClick attribute defined on view class com.ruffian.library.widget.RTextView with id 'iqiyi'
border_width_top="1dp"
border_width_bottom="1dp"
border_width_left="1dp"
border_width_right="1dp"
border_corlor_top="#eeeeee"
border_corlor_bottom="#eeeeee"
border_corlor_left="#eeeeee"
border_corlor_right="#eeeeee"
这个问题在 4.4.* 版本必现
崩溃日志
09-17 14:27:22.690 10498-10498/com.ruffian.library.demo E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.ruffian.library.demo, PID: 10498
java.lang.IllegalStateException: Matrix can not be modified
at android.graphics.Matrix$1.oops(Matrix.java:40)
at android.graphics.Matrix$1.setRectToRect(Matrix.java:202)
at com.ruffian.library.widget.helper.RImageViewHelper.drawBitmapSrc(RImageViewHelper.java:308)
at com.ruffian.library.widget.helper.RImageViewHelper.drawBitmap(RImageViewHelper.java:243)
at com.ruffian.library.widget.helper.RImageViewHelper.onDraw(RImageViewHelper.java:209)
at com.ruffian.library.widget.RImageView.onDraw(RImageView.java:34)
at android.view.View.draw(View.java:14739)
at android.view.View.getDisplayList(View.java:13599)
at android.view.View.getDisplayList(View.java:13646)
解决方案
https://stackoverflow.com/a/25381660
Matrix matrix;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
matrix = mView.getMatrix();
} else {
matrix = new Matrix();
matrix.set(mView.getMatrix());
}
<RadioGroup>
<RRadioButton id=rb1
android:checked="true"
app:text_color_checked="黑色"
app:text_color_normal="白色"
app:text_color_pressed="黑色">
<RRadioButton id=rb2 >
</RadioGroup>
初始rb1是黑色,
代码中设置rb1.setCheck(false)
rb1变成白色,
然后再点击rb1或者rb1.setCheck(true),颜色并没有变成黑色
选中状态和颜色对不上了
private void setBorder() {
mBackgroundNormal.setStroke(mBorderWidthNormal, mBorderColorNormal, mBorderDashWidth, mBorderDashGap);
mBackgroundPressed.setStroke(mBorderWidthPressed, mBorderColorPressed, mBorderDashWidth, mBorderDashGap);
mBackgroundUnable.setStroke(mBorderWidthUnable, mBorderColorUnable, mBorderDashWidth, mBorderDashGap);
mBackgroundUnable.setStroke(mBorderWidthChecked, mBorderColorChecked, mBorderDashWidth, mBorderDashGap);
setBackgroundState();
}
第943行这个mBackgroundUnable是不是写错了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.