2

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

AskQ
  • 3,974
  • 6
  • 28
  • 59

3 Answers3

2

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"/>
Xenolion
  • 10,831
  • 6
  • 27
  • 45
1

As stated here

Add the following style in your res/values/styles.xml file (if you don’t have one, create it.) Here’s a complete file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
  <style name="Theme.Transparent" parent="android:Theme">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowBackground">@android:color/transparent</item>
    <item name="android:windowContentOverlay">@null</item>
    <item name="android:windowNoTitle">true</item>
    <item name="android:windowIsFloating">true</item>
    <item name="android:backgroundDimEnabled">false</item>
  </style>
</resources>

(The value @color/transparent is the color value #00000000 which I put in the res/values/color.xml file. You can also use @android:color/transparent in later Android versions.)

Then apply the style to your activity, for example:

<activity android:name=".SampleActivity" android:theme="@style/Theme.Transparent">
...
</activity>
Hanzala
  • 1,915
  • 1
  • 16
  • 43
0

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>
Khemraj Sharma
  • 52,662
  • 21
  • 188
  • 195