Raju Ugale
Raju Ugale

Reputation: 4281

Design transparent activity on top of other activity

How to approach to this design.
want to design the viewpager activity on top of other activity. It should be have blackish scream background.
Below Screenshot is similar to my requirements.
enter image description here

Upvotes: 2

Views: 1962

Answers (2)

Khemraj Sharma
Khemraj Sharma

Reputation: 58934

This is a simple implementation of the layout you require.

Yo need to keep in mind that parent layout of activity has transparent black background, fragment child of view pager and view pager has transparent background.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#cb000000"
    android:orientation="vertical">


    <ImageView
        android:layout_margin="40dp"
        android:layout_width="40dp"
        android:layout_height="40dp"
        android:src="@color/colorRed" />

    <android.support.v4.view.ViewPager
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="#00000000" />

    <LinearLayout
        android:layout_marginTop="50dp"
        android:id="@+id/viewPagerCountDots"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="5dp"
        android:gravity="center"
        android:orientation="horizontal" />

</LinearLayout>

Upvotes: 0

Xenolion
Xenolion

Reputation: 12717

Option 1. Make a normal Activity and set its Theme as

<activity android:theme="@android:style/Theme.Dialog" />

Option 2. Make an Activity whose onCreate method is just showing a Dialog and then set the theme to be:

<activity android:theme="@android:style/Theme.Translucent.NoTitleBar"/>

Upvotes: 2

Related Questions