lijiankun24 / shadowlayout Goto Github PK
View Code? Open in Web Editor NEW简单好用的阴影库-ShadowLayout
Home Page: http://lijiankun24.com/简单好用的阴影库-ShadowLayout/
简单好用的阴影库-ShadowLayout
Home Page: http://lijiankun24.com/简单好用的阴影库-ShadowLayout/
关闭硬件加速时,shadowlayout中的图片圆角显示失效,开启硬件加速后才可以显示圆角。想问开启硬件加速后会导致其他的bug吗
ShadowLayout not displayed because it is too large to fit into a software layer (or drawing cache), needs 9044356 bytes, only 8294400 available
用于RecyclerView时,当item较多时,onDraw没有回调,一片空白
但是item都在,点击空白仍然相应,当item较少的时候就正常,超过10个 或者说超过一屏,就会有问题
当shadowlayout用作recycleview的item的最外层包裹样式时,会出现部分item外层阴影渲染失败,强行刷新可能会有正常的情况
library的SDK版本设置的太高了,都是26的,可我们项目得用25才可以,肯定有些人的版本更低,这就尴尬了,想用,用不成
已经开启了网络
这个不能代码动态改变阴影颜色啊,我这么写也不好使:
public void setShadowColor(int shadowColor) {
mPaint.setShadowLayer(mShadowRadius, mShadowDx, mShadowDy, shadowColor);
invalidate();
}
使用V2后app:shadowDy=“4dp”,设置后有上边距空隙
经代码分析,setPadding 时机不对,应在
@OverRide
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setPadding();
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
而不是在 onLayout。
Failed to resolve: com.lijiankun24::shadowlayoutx.y.z
Show in File
请问,针对于shadowSide,可以动态设置吗?在java在代码中设置其左、上、右、下等阴影吗?
https://github.com/Devlight/ShadowLayout 这家呢,就是有些需求不能显示。比如嵌套到recyclerviwew里面的百分比布局。或者。百分比设置了banner高度16:9 那么这如何算新的百分比,这真是一个蛋疼的问题。只能偷懒设置16:10
作者代码的onMeasure中
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
……
//计算padding
}
计算测量的顺序是,先进行一次测量 super.onMeasure ,然后设置padding,再进行后续的布局和绘制,但是在这个过程可能会出现 当内部控件有包含圆角的布局时(不知道别的会不会出现,我是这里发现的),漏测了圆角的距离,即:corners android:
radius="..." 。导致后续绘制时出圆角不见的错误
这个错误并不是必现,不过我这里出现频率挺高,分析一下没出现的情况是某些地方自动触发了整个view的二次测量,所以这里修改 onMeasure 为如下,就可避免
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
……
//计算padding
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
实验是在华为M3平板,android7.0上进行的,希望作者可以关注下
`<com.lijiankun24.shadowlayout.ShadowLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
app:shadowColor="#66000000"
app:shadowDx="0dp"
app:shadowDy="0dp"
app:shadowRadius="20dp"
app:shadowSide="all">
<ImageView
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@null"
android:src="@drawable/oval_theme_shape"/>
</com.lijiankun24.shadowlayout.ShadowLayout>`
这个是item的布局
`
<com.heyu.jiamanu.widgets.ShadowLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:shadowColor="#ff000000"
app:shadowRadius="10dp"
app:shadowShape="rectangle"
app:shadowSide="all">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_white_all_radius_6_bg">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/shape_white_all_radius_6_bg"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="14dp"
android:paddingTop="20dp"
android:paddingRight="20dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/tv_title_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="【企业贷-18120821】33天"
android:textColor="#484b5b"
android:textSize="16sp" />
<TextView
android:id="@+id/tv_company"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="上海某广告公司借款5万"
android:textColor="#999999"
android:textSize="14sp" />
</LinearLayout>
<com.heyu.jiamanu.widgets.DrawableTextView
android:id="@+id/tv_step"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:background="#fafafa"
android:paddingLeft="9dp"
android:paddingTop="7dp"
android:paddingRight="9dp"
android:paddingBottom="7dp"
android:text="已回款(1/1)"
android:textColor="#818c94"
android:textSize="14sp"
app:background_unable="@color/white"
app:corner_radius="16dp" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="28dp"
android:background="#f6f6f6" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:paddingLeft="14dp"
android:paddingRight="18dp"
android:paddingBottom="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="已出借 "
android:textColor="#999999"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_lend_money"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="20,000.00元"
android:textColor="#484b5b"
android:textSize="14sp" />
<TextView
android:id="@+id/tv_end_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="到期日 2019/03/27 "
android:textColor="#999999"
android:textSize="14sp" />
</LinearLayout>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
</RelativeLayout>
</FrameLayout>
</com.heyu.jiamanu.widgets.ShadowLayout>
`
<com.heyu.timelease.widget.ShadowLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="60dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="23dp"
app:shadowColor="#1a485b7e"
app:shadowDx="0dp"
app:shadowDy="0dp"
app:shadowRadius="8dp"
app:shadowShape="rectangle"
app:shadowSide="all">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:gravity="center_horizontal"
android:orientation="vertical">
<!--<RelativeLayout-->
<!--android:layout_width="match_parent"-->
<!--android:layout_height="match_parent">-->
<!--正加紧处理中-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
----这个地方设置margin或者padding大于20的话,整个阴影布局就没办法显示
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/black"
android:text="我们将在3个工作日内完成审核"
android:textColor="#bababa"
android:textSize="14sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="34.5dp"
android:layout_marginTop="10dp"
android:background="@color/black"
android:text="请您耐心等待"
android:textColor="#bababa"
android:textSize="14sp" />
</LinearLayout>
<!--</RelativeLayout>-->
<View
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:background="#e1e1e1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="30dp"
android:orientation="vertical">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="决定书编号"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="2018082917574021"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="决定书编号"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="2018082917574021"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="违章代码"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="1039"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:id="@+id/tv_temp_1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="违章行为"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/tv_temp_1"
android:lineSpacingExtra="5dp"
android:text="不按规定停放影响其他车辆和行人通行的不按规定停放影响其他车辆和行人通行的"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="违章时间"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="2018.08.30 11:20:34"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:id="@+id/tv_temp_2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="违章地点"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_toRightOf="@id/tv_temp_2"
android:lineSpacingExtra="5dp"
android:text="上海市静安区南京西路650号对面路段上海市静安区南京西路650号对面路段"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="违章扣分"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="不扣分"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="罚款金额"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="200 元"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="45dp"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="滞纳金"
android:textColor="#999999"
android:textSize="13sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:text="0 元"
android:textColor="#333333"
android:textSize="13sp" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</com.heyu.timelease.widget.ShadowLayout>
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.