是否可以隐藏线性布局中的操作栏?

时间:2014-12-29 14:36:43

标签: android android-actionbar hide

我有一个线性布局,顶部有一个操作栏。贝娄它有一些按钮和相对布局与一些数据。我想知道是否可以在滚动浏览数据时隐藏操作栏,就像在Chrome中一样?向下滚动操作栏隐藏向上滚动并显示。

这是布局的XML代码:

<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<LinearLayout
    android:background="@android:color/black"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:weightSum="1">


    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#353535"/>

    <RadioGroup
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="center_horizontal">

ž

        <RadioButton
            android:button="@null"
            android:checked="true"
            android:contentDescription="ZONA"
            android:background="@drawable/tab_back_selector"
            android:textColor="@color/tab_text_color"
            android:textSize="12sp"
            android:layout_weight="1"
            android:id="@+id/tabZoneHome"
            android:padding="14dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="@string/home_tab_zone"
            android:gravity="center"/>


        <RadioButton
            android:button="@null"
            android:contentDescription="VISITADAS"
            android:background="@drawable/tab_back_selector"
            android:textColor="@color/tab_text_color"
            android:textSize="12sp"
            android:layout_weight="1"
            android:id="@+id/tabVisitedHome"
            android:padding="14dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="@string/home_tab_visited"
            android:gravity="center"
            android:checked="false" />

        <RadioButton
            android:button="@null"
            android:contentDescription="SUGERENCIAS"
            android:background="@drawable/tab_back_selector"
            android:textColor="@color/tab_text_color"
            android:textSize="12sp"
            android:layout_weight="1"
            android:id="@+id/tabSuggestionsHome"
            android:padding="14dp"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="@string/home_tab_suggestions"
            android:gravity="center"
            android:checked="false" />

    </RadioGroup>

    <RelativeLayout
        android:id="@+id/ad_detailholder"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <FrameLayout
            android:id="@+id/frame_container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="6dp"
            android:background="@drawable/quickview_top_gradient"/>

    </RelativeLayout>

    <!-- Framelayout to display Fragments -->

</LinearLayout>
<!-- Listview to display slider menu -->
</android.support.v4.widget.DrawerLayout>

2 个答案:

答案 0 :(得分:0)

这个link有一个有用的模式,可用于实现这一目标。该链接还有sample code reference,您可以参考该任何帮助

答案 1 :(得分:0)

您可以使用getActionBar.hide()