Create Diagonal Cut View in Android
Rotate. View. background. Recently, my friend create a detailed post on how to make diagonal shape view in Android . In that post, he detailed every step to create a custom view to achieve that shape. But, I wonder, if I create that without creating custom view and by using background only. Turn out, I can do that, by rotating the layer-list item. diagonal cut view concept Let’s jump into code and create the view : Create a simple layout <RelativeLayout android:id="@+id/background" android:layout_width="match_parent" android:layout_height="300dp" android:background="@drawable/background" /> Now we need to create the @drawable/background. Create new drawable resource file. Delete generated code, and replace it with layer-list. <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> </layer-list> Layer list basically like a layer in image editor ...
Comments
Post a Comment