java-Android day05

Android Day02

by 木石溪

要点

  • 问题五:安卓布局的几种方式;
  • 问题六:关于EditText组件提示missing accessibility label
  • 问题七:关于Button组件提示Buttons in button bars should be borderless

问题五

安卓的布局方式

  1. 线性布局 LinearLayout
  2. 相对布局 RelativeLayout
  3. 绝对布局 AbsoluteLayout
  4. 帧布局 FrameLayout
  5. 表格布局 TableLayout
  6. 约束布局 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();
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章