ShapeOfView icon indicating copy to clipboard operation
ShapeOfView copied to clipboard

The parent ViewGroup setLayerType(View.LAYER_TYPE_SOFTWARE ,null)

Open zyyoona7 opened this issue 7 years ago • 2 comments

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

zyyoona7 avatar Sep 12 '18 08:09 zyyoona7

why do you set LAYER_TYPE_SOFTWARE manually ?

florent37 avatar Sep 12 '18 21:09 florent37

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

zyyoona7 avatar Sep 13 '18 00:09 zyyoona7