小编Nir*_*pta的帖子

如何自定义列表首选项单选按钮

我已经在我的应用程序中自定义了所有的radioButtons,但listPreference中的radioButtons没有自定义.

我使用了这个名为btn_radio.xml的xml

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:state_window_focused="false"
      android:drawable="@drawable/radio_selected" />
<item android:state_checked="false" android:state_window_focused="false"
      android:drawable="@drawable/radio_unselected" />

<item android:state_checked="true" android:state_pressed="true"
      android:drawable="@drawable/radio_selected" />
<item android:state_checked="false" android:state_pressed="true"
      android:drawable="@drawable/radio_unselected" />

<item android:state_checked="true" android:state_focused="true"
      android:drawable="@drawable/radio_selected" />
<item android:state_checked="false" android:state_focused="true"
      android:drawable="@drawable/radio_unselected" />

<item android:state_checked="false" android:drawable="@drawable/radio_unselected" />
<item android:state_checked="true" android:drawable="@drawable/radio_selected" />
</selector>
Run Code Online (Sandbox Code Playgroud)

这是customRadioButton,它扩展了android自定义单选按钮

<style name="CustomRadioButton"    Parent="@android:style/Widget.CompoundButton.RadioButton">
    <item name="android:button">@drawable/btn_radio</item>
</style>
Run Code Online (Sandbox Code Playgroud)

在我的应用程序的主题中,我做了这个改变

<item name="android:radioButtonStyle">@style/CustomRadioButton</item>
    <item name="android:listChoiceIndicatorSingle">@style/CustomRadioButton</item>
Run Code Online (Sandbox Code Playgroud)

此更改会自定义我的应用程序中的所有radioButtons,但ListPreference中的radioButtons除外

customization android radio-button listpreference

12
推荐指数
1
解决办法
1万
查看次数

在管理应用程序中禁用强制停止按钮

我正在尝试禁用 Android 设置中管理应用程序页面中的强制停止按钮。某些应用程序即使在其服务处于运行状态时也能够执行此操作,强制停止按钮处于禁用状态。请问有人能帮我解决这个问题吗?

java android forceclose

2
推荐指数
1
解决办法
5197
查看次数