小编ash*_*ful的帖子

当新版本可用时强制更新Android应用程序

我在Google Play商店中有一款应用.当更新版本可用时,旧版本将变得无法使用 - 也就是说,如果用户未更新应用程序,则他们不会进入应用程序.当新版本可用时,如何强制用户更新应用程序?

android

86
推荐指数
8
解决办法
12万
查看次数

addonGlobalLayoutListener和addOnPreDrawListener之间的区别

我们知道ViewTreeObserver用于注册可以在视图树中通知全局更改的侦听器.这个类中定义了两种方法是 addOnGlobalLayoutListener(ViewTreeObserver.OnGlobalLayoutListener监听器)和addOnPreDrawListener(ViewTreeObserver.OnPreDrawListener listener).但是在开发者网站中描述的这些方法的目的并不清楚.我试图了解它,并在谷歌搜索,但无法找到关于这个主题的清晰图片.任何帮助对我来说都是极少数.

android android-view

7
推荐指数
1
解决办法
2595
查看次数

如何在Fragment中更改Activity AppbarLayout

我想创建一个像Play商店一样的应用程序.所以有一个导航抽屉.当我们点击Store home Navigation Item或(启动应用程序后的第一个片段)时,有一个看似tablayout进入AppBarLayout.代码在Activity中看起来像这样

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <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/ThemeOverlay.AppCompat.Light"
            app:layout_scrollFlags="scroll|enterAlways" />

        <android.support.design.widget.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

当我们点击其中一个应用程序的应用程序详细信息片段视图中的应用程序似乎AppbarLayout中的CollapsingToolbarLayout.代码就像这样....

<android.support.design.widget.CoordinatorLayout 
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/main_content"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/detail_backdrop_height"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        android:fitsSystemWindows="true">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:expandedTitleMarginStart="48dp"
            app:expandedTitleMarginEnd="64dp">

            <ImageView
                android:id="@+id/backdrop"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:scaleType="centerCrop"
                android:fitsSystemWindows="true"
                app:layout_collapseMode="parallax" />

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
                app:layout_collapseMode="pin" />

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent" …
Run Code Online (Sandbox Code Playgroud)

android android-support-design

5
推荐指数
1
解决办法
4137
查看次数