当前位置: 首页 > news >正文

网站首页图片轮播宁海县建设局网站

网站首页图片轮播,宁海县建设局网站,做网站是先做后台还是前端,网络服务列表在哪里基于Android11增加一个蓝牙开关按钮然后控制蓝牙开关 首先控制蓝牙开关的逻辑很简单#xff0c;bluetoothAdapter.disable();就可以关闭。这里需要用到android.bluetooth.BluetoothAdapter; 1.找到蓝牙界面的xml文件加个按钮 --- a/packages/apps/Settings/res/xml/connect…基于Android11增加一个蓝牙开关按钮然后控制蓝牙开关 首先控制蓝牙开关的逻辑很简单bluetoothAdapter.disable();就可以关闭。这里需要用到android.bluetooth.BluetoothAdapter; 1.找到蓝牙界面的xml文件加个按钮 --- a/packages/apps/Settings/res/xml/connected_devices.xmlb/packages/apps/Settings/res/xml/connected_devices.xml-20,6 20,11 android:keyconnected_devices_screenandroid:titlestring/connected_devices_dashboard_title SwitchPreferenceandroid:keytoggle_bluetoothandroid:titlestring/bluetooth_switch_titleandroid:summarystring/bluetooth_switch_summary/com.android.settings.slices.SlicePreferenceandroid:keybt_nearby_sliceandroid:titlestring/summary_placeholder 2. 在Fragment.java里面添加控制逻辑 这里我曾经尝试写新的controller去控制最后没成功然后又催的比较急。就粗暴一点直接写在Fragment里面了。 --- a/packages/apps/Settings/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.javab/packages/apps/Settings/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment.java-28,6 28,11 import com.android.settings.dashboard.DashboardFragment;import com.android.settings.search.BaseSearchIndexProvider;import com.android.settings.slices.SlicePreferenceController;import com.android.settingslib.search.SearchIndexable; import androidx.preference.SwitchPreferenceCompat; import androidx.preference.SwitchPreference; import androidx.preference.Preference; import android.bluetooth.BluetoothAdapter; import android.os.Bundle;SearchIndexable(forTarget SearchIndexable.ALL ~SearchIndexable.ARC)public class ConnectedDeviceDashboardFragment extends DashboardFragment {-38,6 43,7 public class ConnectedDeviceDashboardFragment extends DashboardFragment {static final String KEY_CONNECTED_DEVICES connected_device_list;VisibleForTestingstatic final String KEY_AVAILABLE_DEVICES available_device_list;static final String KEY_TOGGLE_BLUETOOTH toggle_bluetooth;Overridepublic int getMetricsCategory() {-77,6 83,37 public class ConnectedDeviceDashboardFragment extends DashboardFragment {: null);} Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);SwitchPreference bluetoothSwitch findPreference(KEY_TOGGLE_BLUETOOTH);BluetoothAdapter bluetoothAdapter BluetoothAdapter.getDefaultAdapter();if (bluetoothSwitch ! null) {bluetoothSwitch.setChecked(bluetoothAdapter.isEnabled());bluetoothSwitch.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {Overridepublic boolean onPreferenceChange(Preference preference, Object newValue) {boolean isChecked (Boolean) newValue;BluetoothAdapter bluetoothAdapter BluetoothAdapter.getDefaultAdapter();if (bluetoothAdapter ! null) {if (isChecked) {if (!bluetoothAdapter.isEnabled()) {bluetoothAdapter.enable();}} else {if (bluetoothAdapter.isEnabled()) {bluetoothAdapter.disable();}}}return true;}});}}一开始是写在里面自带的一个onAttach函数里面但是发现没效果可能是正因为函数执行的时候界面还为加载完毕所以没有获取到里面的元素。所以我自己重写了onCreate方法写在这里面。
http://www.yutouwan.com/news/263198/

相关文章:

  • 网站邮件模板手机软件开发工具
  • 制作网站对话框网站建设公司是什么
  • 搜索引擎营销原理是什么重庆网站seo方法
  • 黑龙江生产建设兵团知青网站中文域名网站 被搜索
  • 比较实用的h5网页建设网站泉州网站建设网络推广
  • 网站代码软件网页微博超话签到
  • asp sql做学生信息网站免费制造网站
  • 一起装修网官方网站中企动力 网站价格
  • 建行网站网址是多少怎样注册免费网站
  • 怎么建立自己网站wordpress 初始化
  • 微信公众号的网站雄安网站建设公司
  • 做传销一般是不是有网站深圳龙岗推广公司
  • 网站跳转怎么做2008如何添加iis做网站
  • 长春火车站进站需要核酸检测吗wordpress的首页例子
  • 建设部网站施工员查询用地方名字做网站
  • 怎么建一个公司运营网站微信网站api
  • 群辉可以做网站服务器吗苏州做网站公司怎么样
  • 建设展示类网站的意义深圳各大网站制作哪家公司好
  • 开发网站app公司中文企业网站html模板
  • 专题网站建设工作个人网店和网站的区别
  • 做网站付钱方式安卓app开发视频教程
  • 惠州 企业网站建设什么是竞价推广
  • 找公司做网站需要买服务器广州seo服务
  • 南昌网站设计制作南昌企业网站设计公司
  • 衡阳市建设网站装修公司怎么拉客户
  • 很多卖假药冒产品用二级域名做网站广告设计分为哪几类
  • ps做网站首页怎么运用起来外链收录网站
  • 肇庆网站制作费用推荐 网页游戏
  • 环保网站 怎么做我想做地推怎么找渠道
  • 广州微网站色块网站设计