Android Day02
by 木石溪
要点
- 问题五:安卓布局的几种方式;
- 问题六:关于EditText组件提示missing accessibility label;
- 问题七:关于Button组件提示Buttons in button bars should be borderless;
问题五
安卓的布局方式
- 线性布局 LinearLayout
- 相对布局 RelativeLayout
- 绝对布局 AbsoluteLayout
- 帧布局 FrameLayout
- 表格布局 TableLayout
- 约束布局 ConstraintLayout
问题六
**MISSING ACCESSIBILITY LABEL: WHERE MINSDK < 17, YOU SHOULD PROVIDE AN ‘ANDROID:HINT’ **
在布局文件(默认为main_activity.xml)添加
xmlns:tools="http://schemas.android.com/tools" tools:ignore="LabelFor"
问题七
Buttons in button bars should be borderless; use style="?android:attr/buttonBarButtonStyle" (and ?android:attr/buttonBarStyle on the parent)
在button中添加:
style="?android:buttonStyle"
注意:
buttonStyl为按键布局的一种,可以换为其他的
问题八
针对当targetSdkVersion > 23时FileUriExposedException问题
问题描述:
android.os.FileUriExposedException: file:///storage/emulated/0/DCIM/test.jpg exposed beyond app through ClipData.Item.getUri()
解决方法://在onCreat()函数中添加 StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build()); builder.detectFileUriExposure();