florent37 / ShapeOfView

Give a custom shape to any android view, Material Design 2 ready
Apache License 2.0
3.12k stars 400 forks source link

The parent ViewGroup setLayerType(View.LAYER_TYPE_SOFTWARE ,null) #30

Open zyyoona7 opened 5 years ago

zyyoona7 commented 5 years ago

The parent ViewGroup setLayerType(View.LAYER_TYPE_SOFTWARE ,null) include RoundRectView round corner not working below Android P.

    <FrameLayout
            android:id="@+id/fl_container_2"
            android:layout_width="150dp"
            android:layout_height="150dp"
            android:layout_marginTop="30dp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@id/tv_border">

            <com.github.florent37.shapeofview.shapes.RoundRectView
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                app:shape_roundRect_topLeftRadius="10dp">

                <View
                    android:layout_width="match_parent"
                    android:layout_height="match_parent"
                    android:background="@color/colorPrimaryDark" />
            </com.github.florent37.shapeofview.shapes.RoundRectView>

     </FrameLayout>
        val container2=findViewById<FrameLayout>(R.id.fl_container_2).apply { 
            setLayerType(LAYER_TYPE_SOFTWARE,null)
        }
florent37 commented 5 years ago

why do you set LAYER_TYPE_SOFTWARE manually ?

zyyoona7 commented 5 years ago

I want to set shadow background for container2 by Paint.setShadowLayer(), because I want to change shadow color