实用的Android DialogFragments选择器:android-betterpickers
jopen
10年前
android-betterpickers是一个非常棒的Android选择器类库,用于选择日期,时间、数字等。
用法
For a working implementation of this project see the sample/
folder.
-
Implement the appropriate Handler callbacks:
public class MyActivity extends Activity implements DatePickerDialogFragment.DatePickerDialogHandler { @Override public void onCreate(Bundle savedInstanceState) { // ... } @Override public void onDialogDateSet(int year, int monthOfYear, int dayOfMonth) { // Do something with your date! } }
-
Use one of the Builder classes to create a PickerDialog with a theme:
DatePickerBuilder dpb = new DatePickerBuilder() .setFragmentManager(getSupportFragmentManager()) .setStyleResId(R.style.BetterPickersDialogFragment); dpb.show();