0
A
回答
0
添加工具栏或appbar或者低于这个观点你要显示的影子。
<View
android:id="@+id/shadow_layout"
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/toolbar_dropshadow" />
------- ------ toolbar_dropshadow.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient
android:startColor="@android:color/transparent"
android:endColor="#88333333"
android:angle="90"/>
</shape>
0
设置android:elevation
到Toolbar
如果你的目标是Android 5.0及以上或预棒棒糖做以下。
Toolbar.xml
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbar_height"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/>
<View
android:id="@+id/shadow"
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="@drawable/shadow" />
</LinearLayout>
shadow.xml
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="@color/no_color"
android:endColor="@color/shadow_normal"
android:angle="90" />
</shape>
color.xml
<color name="shadow_normal">#55000000</color>
<color name="no_color">#00000000</color>
0
,你可以简单地使用财产海拔的android:海拔
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="8dp"
android:minHeight="?attr/actionBarSize"
android:background="@color/colorPrimary"
app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">
</android.support.v7.widget.Toolbar>
如果(Build.VERSION.SDK_INT < 21),使用带有阴影背景视图的FrameLayout里面的工具栏下面
给出如下面
<include
android:id="@+id/my_action_bar"
layout="@layout/toolbar" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- activity content here.... -->
<View
android:id="@+id/view_toolbar_shadow"
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="@drawable/toolbar_shadow" />
</FrameLayout>
在活动代码
,你可以隐藏,如果个影子观点dk版本> = 21
View mToolbarShadow = findViewById(R.id.view_toolbar_shadow);
if (Build.VERSION.SDK_INT >= 21) {
mToolbarShadow.setVisibility(View.GONE);
}
相关问题
- 1. 未在儿童活动中显示工具栏
- 2. 在儿童活动中显示DialogFragment Android
- 3. 工具栏没有显示?
- 4. 工具栏标题没有显示在标签式活动中
- 5. 所有活动中的Android工具栏
- 6. Android工具栏没有显示的动作按钮
- 7. wp_list_pages功能没有显示儿童
- 8. 显示内嵌flex影响儿童?
- 9. Android的布局没有显示所有儿童
- 10. ExpandableListView儿童活动
- 11. Android活动没有显示
- 12. 如何处理Android儿童活动没有完成
- 13. Android设置儿童意图动作栏
- 14. activity.setSupportActionBar(工具栏)没有显示工具栏
- 15. Android Studio工具栏自动显示
- 16. Android:工具栏未显示
- 17. 工具栏不显示android
- 18. 获取儿童活动子树
- 19. 没有显示工具栏按钮
- 20. 没有显示工具栏标题
- 21. 工具栏在没有显示
- 22. CKEDITOR工具栏没有完全显示
- 23. Android活动工具栏上一个按钮不显示
- 24. Android完成儿童活动错误
- 25. SlidingMenu儿童活动导航Android
- 26. 作为对话框显示的活动有一个工具栏
- 27. 是否有可能在开始儿童活动时显示alertDialog仍然显示?
- 28. Xamarin中的工具栏Android没有显示图标
- 29. ItemsControl儿童活动WPF C#
- 30. 儿童活动继承父活动
您的定位API> = 21? –
是我的目标API是22 – Vennila