activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rl" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="16dp" tools:context=".MainActivity" android:background="@drawable/relative_layout_background" > </RelativeLayout>
res/drawable/relative_layout_background.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape android:shape="rectangle"> <!-- solid background --> <solid android:color="#fffff528"/> <!-- draw a border around rectangle shape --> <stroke android:color="#ffe21720" android:width="3dp" /> <!-- draw 35 dp radius for each corner --> <corners android:radius="35dp"/> </shape> </item> </selector>
- Programmatically align a view to the bottom of a RelativeLayout
- How to align a view to the top of a RelativeLayout
- How to add rule programmatically to a view in a RelativeLayout
- How to set a drawable to RelativeLayout background
- How to create a rounded corners RelativeLayout
- How to add a border around RelativeLayout
- How to add a bottom border to RelativeLayout
- How to add a View to RelativeLayout programmatically
- How to change RelativeLayout background color programmatically
- How to create a RelativeLayout programmatically
Komentar
Posting Komentar