3
即時通訊使用下面的代碼嘗試隱藏AppBarLayout中的代碼,但它不起作用的FrameLayout。什麼是正確的代碼來抓取AppBarLayout內的框架。 感謝在AppBarLayout中隱藏FrameLayout
API使用23
代碼試圖
FrameLayout search = (FrameLayout) findViewById(R.id.searchbar);
search.setSystemUiVisibility(View.GONE);
佈局app_bar_main
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.place_point.placepoint.MainActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay" />
<FrameLayout
android:id="@+id/searchbar"
android:layout_width="fill_parent"
android:layout_height="56dp"
android:layout_below="@+id/toolbar"
android:layout_marginTop="-56dp"
android:background="#795548">
</FrameLayout>
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_main" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/fab_margin"
android:src="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
太好了,我知道但沒有注意到它。謝啦 :) – Tasos