隱藏狀態欄,toolbar前面空格問題
阿新 • • 發佈:2017-11-29
navi bsp put point ram () size ati match
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"></solid>
<padding android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"></padding>
<corners android:radius="15dp"></corners>
</shape>
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
EditText圓角:
一、在drawable下面添加xml文件rounded_editview.xml
復制代碼 代碼如下:<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#FFFFFF"></solid>
<padding android:left="10dp"
android:top="10dp"
android:right="10dp"
android:bottom="10dp"></padding>
<corners android:radius="15dp"></corners>
</shape>
二、在EditText的background屬性中引用這個xml
復制代碼 代碼如下:
<EditText
android:id="@+id/et_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="text"
android:background="@drawable/rounded_editview"
android:hint="@string/text_hint_username"/>
toolbar左邊空格問題
在xml中添加如下代碼:
<android.support.v7.widget.Toolbar
android:background="@drawable/bg"
android:layout_width="match_parent"
android:layout_height="56dp"
android:fitsSystemWindows="true"
app:contentInsetLeft="0dp"
app:contentInsetStart="0dp"
>
沈浸式狀態欄:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
隱藏:
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
隱藏狀態欄,toolbar前面空格問題