findviewbyid()

记录一个傻掉了的问题:在写项目的时候用到了了collapsingToolbarLayout

自己也不知道怎么回事,怎么就用上了这么个玩意 app:toolbarId(应该是控件拖进去的时候自己就生成了),也没注意

(CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);

一直找不到控件,留这里给自己涨个教训
<android.support.design.widget.CollapsingToolbarLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    app:contentScrim="?attr/colorPrimary"
    app:expandedTitleMarginEnd="64dp"
    app:expandedTitleMarginStart="48dp"
    app:toolbarId="@+id/collapsing_toolbar"
    app:layout_scrollFlags="scroll|exitUntilCollapsed">

android.support.design:toolbarId   e.g. app:toolbarId="@id/toolbar"
The id of the primary Toolbar child that you wish to use for the purpose of collapsing.
在折叠的时候 显示的toolbar的id

猜你喜欢

转载自blog.csdn.net/Super_Jadroid/article/details/82252554
今日推荐