GithubHelp home page GithubHelp logo

lijiankun24 / shadowlayout Goto Github PK

View Code? Open in Web Editor NEW
474.0 474.0 79.0 1.88 MB

简单好用的阴影库-ShadowLayout

Home Page: http://lijiankun24.com/简单好用的阴影库-ShadowLayout/

Java 100.00%

shadowlayout's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

shadowlayout's Issues

用于recycleview时渲染问题

当shadowlayout用作recycleview的item的最外层包裹样式时,会出现部分item外层阴影渲染失败,强行刷新可能会有正常的情况

这个不能动态改变阴影颜色啊

这个不能代码动态改变阴影颜色啊,我这么写也不好使:
public void setShadowColor(int shadowColor) {
mPaint.setShadowLayer(mShadowRadius, mShadowDx, mShadowDy, shadowColor);
invalidate();
}

7.0手机画的有问题

经代码分析,setPadding 时机不对,应在
@OverRide
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setPadding();
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

而不是在 onLayout。

onMeasure 测量时的一个问题

作者代码的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>`

用于recyclerview的item的最外层包裹布局,item的阴影显示不出来

这个是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>

`

包裹一个很长的布局,如果设置间距的话,阴影中的布局就显示不出来了

image

<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>

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.