UX टॉक में "कोच मार्क" "हेल्प ओवरले" है :-)
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();
}
Coach_mark.xml का नमूना जोड़ना (Oded Breiner द्वारा दिए गए इस उत्कृष्ट समाधान के लिए), इसलिए इसके पीपीपी को कॉपी और पेस्ट करने के लिए काम का उदाहरण जल्दी से देखने के लिए आसान है।
यहां कोच_मार्क.एक्सएमएल का नमूना, - अपनी छवि के लिए -> पीने योग्य / कोच_मार्क बदलें:
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>
और पैडिंग को हटाने के लिए वैकल्पिक रूप से इस थीम का उपयोग करें:
<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>