草庐IT

dialog-preference

全部标签

安卓 : Deny button pressed on Bluetooth enabling dialog box

如何处理蓝牙启用对话框中的“拒绝”按钮?我尝试使用OnDismissListener和OnCancelListener甚至尝试使用onActivityResult但没有用。代码是:privateBluetoothAdaptermBluetoothAdapter;privatestaticfinalintREQUEST_ENABLE_BT=1;@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);if(isBleSupportedOnDevice()){ini

android - 从另一个类调用 Dialog

我是android的初学者,我没有在每个Activity中为对话框重复编写代码,而是创建了一个类,其中包含显示对话框的所有方法,我给出了小代码fragmentpublicclassDialoguesextendsActivityimplementsDialogueMethods{publicvoidshowAlertDialog(Contextcontext,Stringtitle,Stringmessage){AlertDialog.BuilderalertDialog=newAlertDialog.Builder(context);alertDialog.setTitle(titl

android - 在没有 Activity 或 Dialog 的情况下安装 .apk

我的应用程序下载一个.apk并使用如下Activity安装它:Android:install.apkprogrammatically但是,它会导致出现一个对话框并需要用户操作。所以我的问题是:有没有不需要用户交互的编程方式?根据评论,我必须提供额外的信息:是的,存在安全隐患。我只是想知道这是否可能。实际上,我确实拥有他们的手机。 最佳答案 不,您不能这样做,用户必须批准所有应用安装。但是,由于这是您的设备,您可以使用adb来安装它而无需对话框!;) 关于android-在没有Activi

android - 使用 android.support.v7.app.AlertDialog 自定义默认的 Theme.AppCompat.Dialog.Alert

我最近将应用中的AlertDialog实例切换为使用android.support.v7.app.AlertDialog,但在应用自定义主题时遇到了问题,并且警报对话框的样式。在我的styles.xml中,我有以下样式:@color/theme_accent_1@color/theme_component_background@color/theme_component_background在我的themes.xml中,我根据需要在我的主题中设置了以下内容:@style/AlertDialog由于某些原因,自定义样式从未应用于AlertDialog实例,它们仍然是默认的Theme.Ap

android - 在不扩展 PreferenceActivity 的情况下加载 preferences.xml

我可以在不扩展PreferenceActivity的情况下加载preferences.xml吗?我需要这个,因为:我想要自定义标题栏我希望我所有的Activity都能扩展我的AbstractActivity 最佳答案 我不认为这很容易,现在无法测试,但从技术上讲它应该是可能的......你应该使用PreferenceManager有一个createPreferenceScreen(Contextctx)方法(显然)返回PreferenceScreen,根据文档:Representsatop-levelPreferencethatis

android - 如何在首选项中制作自定义对话框首选项

我搜索了这个论坛的所有内容,但没有找到我真正需要的东西。我在首选项中需要一个自定义DialogPreference,但DialogPreference不应该有我讨厌的蓝条标题,而且我已经为其他Activity准备了一个Activity标题模板xml文件,可以用作自定义Activity标题。所以我想使用它在这个dialogPreence上。另外我想要自定义首选项文件名,但这里的问题是它创建了两个首选项文件名,一个用于首选项,另一个用于DialogPreference但我在这里找到了类似的东西UsingEditTextPreferencewith2userinputfields到目前为止我

android - Dialog 的 setSoftInputMode 在键入时不隐藏 EditText?

我有一个自定义对话框,它在View底部有一个EditText。当我选择EditText时,键盘出现但在对话框中隐藏了EditText。我知道您可以将windowSoftInputMode用于Activity,引用资料说您可以使用Window.setSoftInputMode()对于非Activity..但是如何做到这一点???Reference我试过这样做GettingKeyboardToAppearWithoutHavingToClickonEditText但是之后Dialog.show();我放了getWindow().setSoftInputMode(WindowManager.

android - onUserInteraction 在 DialogPreference 中不起作用

预计onUserInteraction将被调用以进行任何用户交互。它在PreferenceActivity中运行良好。但是,当DialogPreference弹出时,即使有触摸事件等用户交互,也不会再调用onUserInteraction。DialogPreference似乎不是唯一的情况。每当显示Dialog时,它都不会向Activity报告用户交互。可是真的需要我又能怎样呢。谢谢。 最佳答案 据我所知,当用户与对话框交互时,根本不会调用onUserInteraction()(甚至从您正在监视的Activity开始互动)。我知道的

Android Alert Dialog 用另一种颜色替换默认的蓝色

我正在使用单选警报对话框,我想在其中将默认的蓝色(标题行和单选按钮)替换为我在标题栏中使用的橙色。我可以使用setCustomTitle()更改为标题栏,但我无法尝试摆脱这该死的蓝色。对于标题栏构建AlertDialogAlertDialog.Builderbuilder=newAlertDialog.Builder(MainActivity.this);ViewcustomTitle=View.inflate(MainActivity.this,R.layout.custom_alert_title,null);builder.setCustomTitle(customTitle);

Android:Dialog Fragment 和 Backstack 问题

假设我有以下fragment:fragment1fragment2对话框fragmentfragment3fragment4假设我转到以下fragment,每个fragment都被添加到返回堆栈:Fragment1->Fragment2->DialogFragment->Fragment3->Fragment4如果我单击“返回”按钮,这通常会转到Fragment3,但会显示DialogFragment。这是我使用的fragment交易:fragment1->fragment2FragmentTransactionft=mActivity.getSupportFragmentManage