Android 开发 - layout_editor_absoluteX 与 layout_editor_absoluteY、PreferenceManager
layout_editor_absoluteX 与 layout_editor_absoluteY tools:layout_editor_absoluteX:在布局编辑器中指定 View 的 X 坐标
tools:layout_editor_absoluteY:在布局编辑器中指定 View 的 Y 坐标
这两个是 Android Studio 布局编辑器的预览辅助属性,并不是 Android 系统运行时使用的属性 PreferenceManager SharedPreferences sharedPreferences= PreferenceManager . getDefaultSharedPreferences ( this ) ; SharedPreferences. Editor editor= sharedPreferences. edit ( ) ; // 写入数据 editor. putString ( "username" , "John" ) ; editor. putInt ( "user_age" , 25 ) ; editor. putBoolean ( "notifications" , true ) ; editor. apply ( ) ; // 读取数据 String username= sharedPreferences. getString ( "username" , "default" ) ; int age= sharedPreferences. getInt ( "user_age" , 0 ) ; boolean notifications= sharedPreferences. getBoolean ( "notifications" , false ) ; Log . d ( TAG, "username: " + username) ; Log . d ( TAG, "age: " + age) ; Log . d ( TAG, "notifications: " + notifications) ; # 输出结果 username: John age: 25 notifications: true
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/1191648.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!