2013-12-24 2 views
3

내 앱 상단에서 기본 작업 표시 줄을 제거하고 내 자신의 맞춤 톱 메뉴로 바 꾸었습니다. 이것은 내 애플 리케이션으로 달성하고자하는 많은 문제를 해결했다.새 버튼에서 앱 설정 열기

유일한 문제는 지금 작업 표시 줄에 있던 기본 설정 버튼에 액세스 할 수 없다는 것입니다. 내 자신 만의 설정 팝업을 만들려고했지만 새로운 활동을 시작하지 않고 팝업 대화 상자로 시작하는 방법을 모르겠습니다. 이것은 기본 설정 메뉴 팝업과 다릅니다.

맨 위에 사용자 지정 작업 표시 줄과 함께 이것을 복제 할 수있는 방법이 있습니까?

+0

체크 [이 (http://stackoverflow.com/a/17872878/1777090) –

답변

0

사용

startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0); 
0

버튼 리스너에이 코드 당신은 설정 팝업 모방하는 사용자 정의 대화와 DialogFragment를 사용할 수 있습니다.

public class CustomDialogFragment extends DialogFragment { 

    @Override 
    public Dialog onCreateDialog(Bundle savedInstanceState) { 
     CustomDialog dialog = CustomDialog(getActivity()); 

     // Position the dialog window below your action bar 
     Window window = dialog.getWindow(); 
     WindowManager.LayoutParams lp = new WindowManager.LayoutParams(); 
     lp.gravity = Gravity.TOP | Gravity.RIGHT; 
     lp.y = 100; // action bar height 
     window.setAttributes(lp); 

     return dialog; 
    } 

    private class CustomDialog extends Dialog { 

     public CustomDialog(Context context) { 
      super(context); 

      // do not show the title of the dialog box and dismiss 
      // it if touched outside, as the normal settings pop up 
      requestWindowFeature(Window.FEATURE_NO_TITLE); 
      setCanceledOnTouchOutside(true); 

      // your custom layout 
      setContentView(R.layout.custom_layout); 
     } 

    } 
} 

나서 그것을 보여

CustomDialogFragment popup = new CustomDialogFragment(); 
popup.show(getFragmentManager(), "");