ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î


Coach mark View [Android]
7³â Àü
Let's assume you ordinarily would call setContentView(R.layout.main), but on first run, you want to have this overlay.

Step #1: Create a FrameLayout in Java code and pass that to setContentView().

Step #2: Use LayoutInflater to inflate R.layout.main into the FrameLayout.

Step #3: Use LayoutInflater to inflate the overlay into the FrameLayout.

Step #4: When the user taps the button (or whatever) to dismiss the overlay, call removeView() to remove the overlay from the FrameLayout.

Since the overlay is a later child of the FrameLayout, it will float over top of the contents of R.layout.main.



"Coach mark" is "Help overlay" in UX talk :-)

coach_mark.xml is your coach mark layout

coach_mark_master_view is the id of the top most view (root) in coach_mark.xml

public void onCoachMark(){

    final Dialog dialog = new Dialog(this);
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
    dialog.setContentView(R.layout.coach_mark);
    dialog.setCanceledOnTouchOutside(true);
    //for dismissing anywhere you touch
    View masterView = dialog.findViewById(R.id.coach_mark_master_view);
    masterView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            dialog.dismiss();
        }
    });
    dialog.show();
}
Adding sample of coach_mark.xml (to this excellent solution given by Oded Breiner), so its easy for ppl to copy & paste to see working example quickly.

Sample of coach_mark.xml here, change the -> drawable/coach_marks to your image:

coach_mark.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:id="@+id/coach_mark_master_view">
    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
         <ImageView
             android:id="@+id/coach_marks_image"
             android:layout_width="match_parent"
             android:layout_height="match_parent"
             android:layout_centerInParent="true"
             android:layout_gravity="center_horizontal"
             android:src="@drawable/coach_marks" />
    </RelativeLayout>
</LinearLayout>
And optionally use this theme to remove padding:

<style name="WalkthroughTheme" parent="Theme.AppCompat">
    <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:backgroundDimEnabled">false</item>
</style>
ÃßõÃßõ : 228 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,166
Android WebView Facebook Login (popup/redirection issues)
1,165
Loading GIF [Android]listView ¿ø°ÝÀ̹ÌÁö [Android]
1,164
¾Û ¹öÀü üũ ½ºÅä¾î·Î À̵¿ [Android]
1,163
WebViewClient [Android]
1,162
http post get Àü¼Û
1,161
À¥ºä ¸Þ¼Òµå È£ÃâÀÌ ¾ÈµÉ ¶§ (android.permission.INTERACT_ACROSS_USERS_FULL)
1,160
°³¹ß Áß ¿¡·¯ ¹ß»ý½Ã ¿¡·¯ ³»¿ë È®ÀÎ, ÇØ°á¹æ¹ý [Android]
1,159
ij½Ã Áö¿ì±â [Android]
1,158
¹Ù·ÎÇ®¾î(¼öÇÐ ¹®Á¦ ÁúÀÇÀÀ´ä SNS) ¿¡ »ç¿ëµÈ ¿ÀǼҽº ¶óÀ̺귯¸® [Android]
1,157
¿ÀǼҽº ¶óÀ̺귯¸® ¸ðÀ½ [Android]
1,156
´Ü¸»±â ¹öÀü Á¤º¸ [Android]
1,155
Android webview °³¹ß½Ã ¾Ë¾ÆµÖ¾ß ÇÒ °Íµé [Android]
1,154
[¾Èµå·ÎÀ̵å] ¾Û ³»¿¡¼­ ·±Å¸ÀÓ ±ÇÇÑÀ» ¿äûÇÏ´Â ¹æ¹ý
1,153
webview µ¿¿µ»ó Àç»ý [Android]
1,152
android studio DefaultHttpClient, HttpClient import ¿¡·¯
1,151
[Android] ANR À̶õ?
1,150
¾Èµå·ÎÀÌµå ¿ÀǼҽº
1,149
Android] AlarmManager ÀÏÁ¤½Ã°£ À̺¥Æ® ½ÇÇà
1,148
[Android] Webview url ¼û±â±â
1,147
[Android] webview ssl ¹®Á¦
1,146
[Android] Webview 404 ¿¡·¯ ó¸®
1,145
[Android] Webview ¸Þ¼Òµå
1,144
[¾Èµå·ÎÀ̵å] À¥ºä(WebView ¿¡¼­ ÀÚ¹Ù½ºÅ©¸³Æ® alert ¶ç¿ì±â
1,143
(Android) WebView _blank ó¸®
1,142
webvew ¿¡¼­ ºê¶ó¿ìÀú·Î ¸µÅ©(_blank)
1,141
[Android]¾Èµå·ÎÀ̵å Intent »ç¿ë¹ý
1,140
¾Èµå·ÎÀÌµå ¹Ìµð¾î Ç÷¹À̾î (MediaPlayer) ¿¹Á¦
1,139
[Android] BroadcastReceiver »ç¿ëÇϱâ
1,138
Media Player¸¦ ÀÌ¿ëÇÑ À½¾Ç Àç»ý
1,137
[°³¹ß Tip] Activity³» ¹è°æÀ» Åõ¸íÇÏ°Ô Çϱâ
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.