몇 달 전 HTC ONE X를 구입했습니다. 대화 형 위젯과 기능을 사용하여 전화로 첫 걸음을 내딛을 때 사용자를 안내하는 방법에 감탄했습니다.안드로이드 응용 프로그램을위한 둘러보기를 만드는 방법
이 기능을 Rogerthat에 추가하고 싶습니다.이 기능을 우리가 구축하고있는 앱에 추가하고 싶지만, 이것을 달성 할 수있는 도구/라이브러리가 있는지 궁금합니다.
몇 달 전 HTC ONE X를 구입했습니다. 대화 형 위젯과 기능을 사용하여 전화로 첫 걸음을 내딛을 때 사용자를 안내하는 방법에 감탄했습니다.안드로이드 응용 프로그램을위한 둘러보기를 만드는 방법
이 기능을 Rogerthat에 추가하고 싶습니다.이 기능을 우리가 구축하고있는 앱에 추가하고 싶지만, 이것을 달성 할 수있는 도구/라이브러리가 있는지 궁금합니다.
사용자가 지침을보고 4 개의 노트 페이지를 탐색 할 수있는 앱 둘러보기를 수행했습니다.
public static void tour(final Context context, final String title, final int pageNumber,
final Drawable icon, final String[] pageMessage, final int[] layouts, final ViewGroup root) {
Builder tourDialog = new AlertDialog.Builder(context);
int nPage = 0;
if (pageMessage!=null){
tourDialog.setMessage(pageMessage[pageNumber]);
nPage = pageMessage.length;
}
if (layouts!=null){
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
View layout1 = inflater.inflate(layouts[pageNumber], root);
tourDialog.setView(layout1);
//tourDialog.setView(views[pageNumber]);
nPage = layouts.length;
}
tourDialog.setTitle(title+" (page "+(pageNumber+1)+"/"+nPage+")");
tourDialog.setPositiveButton("Prev",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
tour(context, title, pageNumber-1, icon, pageMessage,layouts, root);
return;
}
});
tourDialog.setNeutralButton("Next",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
tour(context, title, pageNumber+1, icon, pageMessage,layouts, root);
return;
}
});
tourDialog.setNegativeButton("Ok",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int whichButton) {
return;
}
});
if (icon!=null)
tourDialog.setIcon(icon);
AlertDialog dialog = tourDialog.create();
dialog.show();
if (pageNumber==0)
dialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(false);
else if (pageNumber==nPage-1){
dialog.getButton(AlertDialog.BUTTON_NEUTRAL).setEnabled(false);
}
}
사용 예 :
int[] layout = {R.layout.note1, R.layout.note2, R.layout.note3, R.layout.note4}; //resource id of each page's layout
tour(context, "Notes ", 0,getResources().getDrawable(R.drawable.gmpte_logo_25px),null, layout, (ViewGroup) findViewById(R.id.root));
와 노트 페이지 레이아웃의 예 다음은 코드의 각 노트 페이지에 대한 자신의 레이아웃을 작성해야
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/root"
android:padding="10dip">
<TextView android:id="@+id/text_before"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFF"
android:textSize="16dp"
android:text="@string/note1_before_text"
android:layout_marginTop="10dp"/>
<ImageView android:id="@+id/image"
android:contentDescription="@string/desc"
android:src="@drawable/mylocation_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@+id/text_before"
/>
<TextView
android:id="@+id/text_after"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/text_before"
android:layout_below="@+id/image"
android:text="@string/note1_after_text"
android:textColor="#FFF"
android:textSize="16dp" />
</RelativeLayout>
,하지만 각 페이지의 루트 레이아웃에 동일한 ID (android:id="@+id/root"
)를 사용하십시오.
Roman Nurik은 이런 종류의 작업을 수행하기 위해 "Wizard Pager"라는 라이브러리를 구성했습니다. 그것은 당신이 요구하는 것을하는 데 사용될 수 있습니다.
http://code.google.com/p/romannurik-code/source/browse/misc/wizardpager
https://plus.google.com/113735310430199015092/posts/6cVymZvn3f4
는 업데이트 :나는이 또한 당신에게 도움이 될 것 같아요. 그것은 ICS +에 주식 안드로이드 ROM을 처음 실행할 때 보여지는 투어와 비슷합니다.
도서관은 안드로이드의 모든 버전에서 사용할 수 있습니다
https://github.com/Espiandev/ShowcaseView
이 expansio 볼 수 전시는 연속하려면 다음
ViewPager 및 단편을 사용하여 도움말 화면을 표시하십시오. 그것에 대한 충분한 정보를 찾을 수 있습니다.
내가 A 앱 투어를 만들기위한 간단한 구성 요소가 포함 된 작은 도서관 을 썼다. 그것은 내 경우에만 제한되어 있지만 어쩌면 당신의 경우 일 수 있습니다. 단일 LessonCardView 처음 시작시 표시 또는 버튼 클릭 비평, 도움 또는 조언을 주시면 감사하겠습니다. 덕분에 https://github.com/dnocode/DnoLib
저는 대화 상자를 찾는 것이 아니라 사용자 인터페이스 요소를 가리키는 화살표가있는 작은 도움말 텍스트를 찾는 것입니다. –