本文整理匯總了Java中android.support.v7.app.AppCompatDialogFragment.show方法的典型用法代碼示例。如果您正苦於以下問題:Java AppCompatDialogFragment.show方法的具體用法?Java AppCompatDialogFragment.show怎麽用?Java AppCompatDialogFragment.show使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.v7.app.AppCompatDialogFragment
的用法示例。
在下文中一共展示了AppCompatDialogFragment.show方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onOptionsItemSelected
import android.support.v7.app.AppCompatDialogFragment; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
return true;
case R.id.action_about:
AppCompatDialogFragment frag = new AboutDialogFragment();
frag.show(getSupportFragmentManager(), "dialog1");
return true;
}
return super.onOptionsItemSelected(item);
}
示例2: onOptionsItemSelected
import android.support.v7.app.AppCompatDialogFragment; //導入方法依賴的package包/類
@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
// setting menu activity is launched
if (id == R.id.action_settings) {
Intent settings = new Intent(this, SettingsActivity.class);
startActivity(settings);
return true;
}
// about activity is launched
if (id == R.id.action_about) {
AppCompatDialogFragment newFragment = AboutDialogFragment.newInstance();
newFragment.show(getSupportFragmentManager(), "dialog");
return true;
}
// connect action
if (id == R.id.action_connect) {
presenter.onConnectMenuClicked();
return true;
}
// clear all preset
if (id == R.id.action_clear_preset) {
new MaterialDialog.Builder(this)
.title("Clear all the presets?")
.content("This will clear all the guitarix presets stored on the device. Guitarix presets will remain intact. Do you wish to continue?")
.positiveText(R.string.agree)
.negativeText("Cancel")
.onPositive(new MaterialDialog.SingleButtonCallback() {
@Override
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
presenter.clearAllPreset();
}
})
.show();
return true;
}
return super.onOptionsItemSelected(item);
}
示例3: showFragment
import android.support.v7.app.AppCompatDialogFragment; //導入方法依賴的package包/類
public static void showFragment(Activity activity, Bundle bundle, AppCompatDialogFragment fragmentClass) {
FragmentTransaction ft = ((AppCompatActivity) activity).getSupportFragmentManager().beginTransaction();
fragmentClass.setArguments(bundle);
fragmentClass.show(ft, null);
}