我正在使用CollapsingToolbarLayout,当collapsingToolbarLayout提起时,我想在工具栏上显示配置文件图像以及标题。请提供相关的代码或库。CollapsingToolbarLayout与工具栏上的图像android
回答
使用这样的:
<android.support.design.widget.AppBarLayout
android:id="@+id/app_bar"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="false"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleTextAppearance="@style/TransparentText"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:foreground="?attr/selectableItemBackground"
android:orientation="vertical"
android:paddingTop="?actionBarSize"
app:layout_collapseMode="parallax">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/test_img"
android:id="@+id/profile_image">
</ImageView>
</FrameLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
用它在你的coordinateLayout。并根据您的喜好定位您的图片。
我试过这个,但它不工作,因为我喜欢。请参考这个更好的理解http://stackoverflow.com/questions/33066164/add-a-imageicon-to-the-collapsing-layout-support-library –
参考这个链接:[链接] http://saulmm.github .io/mastering-coordinator 这是很好的文章坐标布局 –
我需要在折叠后显示在工具栏上的图像 –
- 1. CollapsingToolBarLayout有双重工具栏
- 2. CollapsingToolbarLayout中心工具栏中的TextView
- 3. 使工具栏在CollapsingToolbarLayout中消失
- 4. CollapsingToolbarLayout标题不放入工具栏
- 5. CollapsingToolbarLayout /工具栏过早/过时淡化
- 6. 工具栏不能位于CollapsingToolbarLayout顶部
- 7. CollapsingToolbarLayout问题:与工具栏重叠的UI
- 8. 底部工具栏与3图像
- 9. 双工具栏上的Android
- 10. CollapsingToolbarLayout图像低于状态栏
- 11. 的Android DrawerLayout与自定义工具栏
- 12. 带图像的自定义工具栏
- 13. 更改工具栏按钮的图像
- 14. 在工具栏上覆盖图像视图的一部分
- 15. Android Studio上的工具栏呈现
- 16. 把工具栏上面的ActionBar android
- 17. Android的工具栏图标定位
- 18. Android工具栏:Light.DarkActionBar
- 19. 工具栏中的标题图像对齐方式android
- 20. 将图标与工具栏图标对齐 - Android Material Design
- 21. CollapsingToolbarLayout内部Viewpager:工具栏代理奇怪
- 22. 更改工具栏和CollapsingToolbarLayout以编程方式滚动标志
- 23. CollapsingToolbarLayout:保持工具栏但隐藏TabLayout并快速返回
- 24. 当CollapsingToolbarLayout崩溃时,工具栏标题不显示
- 25. 工具栏图像,令人困惑
- 26. 添加图像到工具栏
- 27. 24位工具栏按钮图像? (WinAPI)
- 28. 工具栏隐藏导航图像
- 29. 虽然使用导航抽屉CollapsingToolbarLayout与ImageView工具栏不显示
- 30. 工具提示与图像
你使用的是android studio还是eclipse? – AbhayBohra
我正在使用android工作室 –