Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TintAppBarLayout中嵌套CollapsingToolbarLayout和TintToolbar,折叠后toolbar颜色问题 #5

Closed
ximencx opened this issue Aug 19, 2016 · 4 comments

Comments

@ximencx
Copy link

ximencx commented Aug 19, 2016

布局文件如下:
问题:1,折叠后toolbar是透明的,颜色不知道怎么设置,demo也没有??
2,状态栏必须在每个activity的onpostcreat()方法中,设置状态栏么??
3,怎么设置默认值?能否在application中设置?

<com.bilibili.magicasakura.widgets.TintAppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@color/theme_color_primary"
    android:fitsSystemWindows="true"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">


    <android.support.design.widget.CollapsingToolbarLayout
        android:id="@+id/coll_toolbar_layout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/detail_image_height"
        android:fitsSystemWindows="true"
        app:expandedTitleMarginEnd="96dp"
        app:expandedTitleMarginStart="48dp"
        app:layout_scrollFlags="scroll|exitUntilCollapsed">


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

        <View
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="bottom"
            android:background="@drawable/black_bg" />

        <com.bilibili.magicasakura.widgets.TintToolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:backgroundTint="@color/theme_color_primary"
            app:layout_collapseMode="pin" />

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

    <android.support.design.widget.TabLayout
        android:id="@+id/tab_layout"
        android:layout_width="match_parent"
        android:layout_height="@dimen/tablayout_height"
        android:visibility="gone"
        app:tabIndicatorColor="@color/white"
        app:tabSelectedTextColor="@color/white"
        app:tabTextColor="@color/white" />
</com.bilibili.magicasakura.widgets.TintAppBarLayout>

<com.jude.easyrecyclerview.EasyRecyclerView
    android:id="@+id/recycler_view"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    app:scrollbarStyle="insideOverlay" />

<RelativeLayout
    android:id="@+id/rl_progress"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/white"
    android:visibility="visible">

    <ProgressBar
        android:id="@+id/pb_progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true" />

    <TextView
        android:id="@+id/tv_progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:padding="@dimen/padding_16"
        android:text="@string/tryagain"
        android:textColor="@color/text_primary_color"
        android:textSize="@dimen/textsize_16" />
</RelativeLayout>
@xyczero
Copy link
Member

xyczero commented Aug 21, 2016

回答问题:
1,CollapsingToolbarLayout需要设置setContentScrimColor的颜色,这是design库自己的使用方式,和框架无关,demo中之后会补充相关例子。
2,状态栏的颜色设置不同android版本有不同的处理方案,请自行google或github
3,框架的的颜色替换规则就是在Application中进行设置的,你指的默认值是?

@ximencx
Copy link
Author

ximencx commented Aug 21, 2016

1,第2个问题状态栏颜色,如果集成前框架前没有处理状态栏,切换主题只设置当前activity状态栏。会有风格不统一的问题。能否框架给个可选项的api。 2,第三个问题意思是,设置默认主题的颜色,和框架怎么自定义颜色,更改哪些颜色能否给个具体的说明或者demo。 thx~~

@xyczero
Copy link
Member

xyczero commented Aug 21, 2016

问题1: 如果集成框架前没有处理状态栏着色,请自行google。如果之前处理了状态栏,只需调用框架的提供的方法进行相应的着色即可。框架本身不处理状态栏问题。
问题2: 目前设置主题的默认色只能在res/values/colors.xml中,替换规则是在Application中实现,具体见 README中的STEP1和STEP2。
至于能改哪些颜色完全是根据app自己的需求而定,并无任何约束,框架只是负责根据规则替换染色,取色。

@ximencx
Copy link
Author

ximencx commented Aug 22, 2016

已解决问题,谢谢大神

@ximencx ximencx closed this as completed Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants