In the below example I have created popup layout. In popup.activity layout, First I have created LinearLayout, In LinearLayout I added a TextViw and Button, then in step second I have created rounded.xml layout & in drawable folder, here I have also added dialog shape and color properties. You can see below program it will clearly describe you to create how to create popup layout window in android
Step(1)-popup_activity.xml layout-
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="250dp"
android:layout_margin="@dimen/margin_medium"
android:background="@drawable/rounded_border"
android:padding="@dimen/padding_small"
android:layout_gravity="center"
android:layout_height="110dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="@dimen/padding_small"
android:gravity="center"
android:textColor="@color/colorSpecialOffer"
android:textSize="@dimen/text_medium"
android:text="@string/maxSelectCat"/>
<Button
android:layout_width="80dp"
android:layout_gravity="center"
android:text="@string/ok"
android:id="@+id/okButton"
android:layout_marginTop="@dimen/margin_medium"
android:textColor="@color/colorSpecialOffer"
android:textSize="@dimen/text_large"
android:background="@drawable/rounded_border"
android:layout_height="30dp" />
</LinearLayout>
</RelativeLayout>
Step(2)-Create a rounded.xml layout in drawable folder
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<solid android:color="@color/font_color" />
<corners android:radius="12dip" />
<stroke
android:width="1dip"
android:color="@color/colorPrimaryDark" />
</shape>
</item>
</layer-list>
0 Comment(s)