1

I am trying to create a help screen overlay which appears the first time the app is run which covers the entire screen including the action bar. I have the logic to work out if the app has been launched before, however I'm struggling to get the overlay to cover the action bar.

I have tried a few different techniques, including a custom dialog and calling a new layout on top, all of which seem to not cover the action bar. Could some please help me.

in the onCreate method:

Dialog helpOverlay = new Dialog(HomeActivity.this);
helpOverlay.requestWindowFeature(Window.FEATURE_NO_TITLE);
helpOverlay.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));  
helpOverlay.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
helpOverlay.getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
helpOverlay.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
WindowManager.LayoutParams params = helpOverlay.getWindow().getAttributes();

params.gravity = Gravity.TOP | Gravity.LEFT;
params.x = 100;
params.y = 20;
// If user taps anywhere on the screen, dialog will be cancelled.
helpOverlay.setCancelable(true);
// Setting the content using prepared XML layout file.
helpOverlay.setContentView(R.layout.help_overlay);
helpOverlay.show();

help_overlay.xml

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout 
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/home_overlay_layout_test"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" 
        android:windowActionBarOverlay="true">

        <ImageView
            android:id="@+id/help_overlay_test"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"

            android:layout_alignParentTop="true"

            android:src="@drawable/helphome" />

    </RelativeLayout>

The helphome image is a 9-patch image which I was hoping to use for all resolutions.

EDIT:

I have also tried the method in the link below. but with the same results, not covering the action bar:

http://www.christianpeeters.com/android-tutorials/android-tutorial-overlay-with-user-instructions/

James King
  • 2,247
  • 7
  • 27
  • 40

2 Answers2

3

maybe this open-source library is what you're looking for:

Showcase View

enter image description here

You can grab the source code and setup instructions from GitHub.

hop to be usefull :)

FxRi4
  • 932
  • 7
  • 14
  • thanks, i have been looking for something like this but using "android" + "tutorial" as google keywords never showed up anything useful! – Su-Au Hwang Jan 07 '14 at 08:59
3

You can set it in the manifest file

    <activity
        android:name="com.android.YourActivity"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
Navaneeth
  • 843
  • 7
  • 11