Я хочу сделать actionBar моей деятельности невидимым. hide()
не работает для меня, потому что полностью удаляет actionBar, а действие не поддерживает высоту представления после его скрытия.
Как я могу это сделать?
РЕДАКТИРОВАТЬ (обновление кода):
макет. xml:
<LinearLayout
android:id="@+id/top_bar"
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<ImageButton
android:id="@+id/detail_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_back_dark"
android:contentDescription="@string/back_button"
android:background="?attr/selectableItemBackgroundBorderless"
android:padding="16dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_gravity="center_vertical" />
<TextView
android:id="@+id/user_selected_name_surname"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:text="Detail"
android:textSize="22sp"
android:gravity="center|start"/>
</LinearLayout>
<View
android:id="@+id/top_bar_divider"
android:layout_below="@id/notification_top_bar"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey_color"/>
И в деятельности. java, я просто установить линейный макет и делитель на невидимку:
topBar.setVisibility(View.INVISIBLE);
topBarDivider.setVisibility(View.INVISIBLE);