gpt4 book ai didi

android - collapsingToolbarLayout 仅在折叠时设置标题

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:33:24 25 4
gpt4 key购买 nike

我试图仅在折叠时设置 collapsingToolbarLayout 标题

为此我设置了:

app:expandedTitleTextAppearance="@android:color/transparent"

而且效果很好。

但在 4.2.2 应用程序崩溃并显示以下日志

STACK_TRACE

java.lang.IllegalArgumentException: width and height must be > 0
at android.graphics.Bitmap.createBitmap(Bitmap.java:687)
at android.graphics.Bitmap.createBitmap(Bitmap.java:666)
at android.graphics.Bitmap.createBitmap(Bitmap.java:633)
at android.support.design.widget.CollapsingTextHelper.ensureExpandedTexture(CollapsingTextHelper.java:405)
at android.support.design.widget.CollapsingTextHelper.setInterpolatedTextSize(CollapsingTextHelper.java:382)
at android.support.design.widget.CollapsingTextHelper.calculateOffsets(CollapsingTextHelper.java:227)
at android.support.design.widget.CollapsingTextHelper.setExpansionFraction(CollapsingTextHelper.java:203)
at android.support.design.widget.CollapsingToolbarLayout$OffsetUpdateListener.onOffsetChanged(CollapsingToolbarLayout.java:754)
at android.support.design.widget.AppBarLayout$Behavior.dispatchOffsetUpdates(AppBarLayout.java:851)
at android.support.design.widget.AppBarLayout$Behavior.setAppBarTopBottomOffset(AppBarLayout.java:834)
at android.support.design.widget.AppBarLayout$Behavior.scroll(AppBarLayout.java:793)
at android.support.design.widget.AppBarLayout$Behavior.onNestedScroll(AppBarLayout.java:644)
at android.support.design.widget.AppBarLayout$Behavior.onNestedScroll(AppBarLayout.java:583)
at android.support.design.widget.CoordinatorLayout.onNestedScroll(CoordinatorLayout.java:1428)
at android.support.v4.view.eh.a(ViewParentCompat.java:97)
at android.support.v4.view.ec.a(ViewParentCompat.java:330)
at android.support.v4.view.bk.a(NestedScrollingChildHelper.java:162)
at android.support.v7.widget.RecyclerView.dispatchNestedScroll(RecyclerView.java:8306)
at android.support.v7.widget.RecyclerView.scrollByInternal(RecyclerView.java:1387)
at android.support.v7.widget.RecyclerView.onTouchEvent(RecyclerView.java:2209)

请建议我正确的实现方式。

是否有任何 Listener 来检测 collapsingToolbarLayout 是否折叠,以便我可以隐藏/取消隐藏 ToolBar 标题...

是否可以将 collapsingToolbarLayout 标题设置为与我想要的另一个 View 对齐...

最佳答案

最终 CollapsingToolbarLayout 如下:-

collapsingToolbarLayout = (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
collapsingToolbarLayout.setTitle("Create Delivery Personnel");
collapsingToolbarLayout.setExpandedTitleColor(getResources().getColor(R.color.transperent));
collapsingToolbarLayout.setCollapsedTitleTextColor(Color.rgb(0, 0, 0));

关于android - collapsingToolbarLayout 仅在折叠时设置标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32156044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com