2016-08-03 3 views
0

내 기능 중 하나는 사용자가 월과 연도를 선택해야하기 때문에 다음은 첨부 된 첫 번째 이미지 (d/m/y)를 표시하는 방법입니다. Android : DatePicker 대화 상자에서 날짜 사용/사용 중지

enter image description here

final Calendar c = Calendar.getInstance(); 

         int year = c.get(Calendar.YEAR); 
         int month = c.get(Calendar.MONTH); 
         int day = c.get(Calendar.DAY_OF_MONTH); 

         DatePickerDialog dp = new DatePickerDialog(getActivity(), android.R.style.Theme_Holo_Light_Dialog_MinWidth, 
           new DatePickerDialog.OnDateSetListener() { 

            @Override 
            public void onDateSet(DatePicker view, int year, int monthOfYear, int dayOfMonth) { 
             //Check if selected month/year is in future of today. 
            } 

           }, year, month, day); 

         dp.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); 
         dp.setTitle("Set Monthly Overview"); 
         dp.show(); 

그러나, 나는 하지 날짜를 필요로 할. 어떻게하면 사용자가 그것을 선택하지 못하게 할 수 있습니까 아니면 모두의 무엇보다도 가장 좋은 옵션은입니다.

내가 달성하고자하는 것은 최선의 시나리오에서 다음 이미지와 유사합니다.

enter image description here

+1

사용자 정의 UI에 대한 항목을 읽을 수 있습니다. http://sunilsuthar02.blogspot.in/2013/04/date-picker-like-iphone-in-android.html – sonnv1368

+0

http://stackoverflow.com/questions/10673842/android-hide-date-field-in -datepickerdialog – sasikumar

답변