我正在尝试使用最新的设计库让我的工具栏在滚动时隐藏/显示.我的问题是我在片段中的滚动内容,我只是将它注入到FrameLayout容器中,它不起作用.这是我的活动:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.CoordinatorLayout
android:id="@+id/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/layout_toolbar" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</android.support.design.widget.CoordinatorLayout>
<FrameLayout
android:id="@+id/navigation_drawer_container"
android:layout_width="@dimen/navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
tools:layout="@layout/fragment_nav_drawer_anon" />
Run Code Online (Sandbox Code Playgroud)
和我的片段:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/pull_to_refresh"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</android.support.v4.widget.SwipeRefreshLayout>
<TextView
android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textSize="18sp"
android:fontFamily="sans-serif"
android:color="@color/dark_grey"
android:padding="60dp"/>
Run Code Online (Sandbox Code Playgroud)
和工具栏:
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:minHeight="?attr/actionBarSize"
app:layout_scrollFlags="scroll|enterAlways"
style="@style/Widget.MyApp.ActionBar" />
Run Code Online (Sandbox Code Playgroud)
android android-toolbar android-design-library android-coordinatorlayout
我开发了一个应用程序并支持Android 6.0。当我在“设置”->“应用程序”->“重置应用程序首选项”中重置应用程序首选项时,我的应用程序的所有权限都被吊销,并且该应用程序未重新启动。撤消其权限后无法重新启动该应用程序可能会导致许多意外崩溃。
我应该如何处理这种情况?
当我手动撤消其权限(设置->应用程序->我的应用程序->权限)时,该应用程序将重新启动。
permissions android android-permissions android-6.0-marshmallow