我在Android應用中使用Google's support design library v25.1.0實施Bottom Navigation Bar。有什麼方法可以添加投影效果,與當前Android本機Google相冊應用相同?Android底部導航欄帶陰影
9
A
回答
27
您可以使用簡單的查看和背景繪製自己的影子正上方的底欄:
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:layout_above="@id/bottom_bar"
android:background="@drawable/shadow"/>
繪製/ shadow.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#1F000000"
android:endColor="@android:color/transparent"
android:angle="90" />
</shape>
而且,沒有兼容性問題,如果使用這種方法。
2
您可以使用標高陰影添加到任何視圖
<TextView
android:id="@+id/myview"
...
android:elevation="2dp"
android:background="@drawable/myrect" />
參考this瞭解更多信息
+0
在我的項目中不起作用:「屬性」提升「僅用於API級別21和更高(當前最小值爲16)」,如果確實有效,則會使用該屬性。 –
相關問題
- 1. 如何刪除底部陰影的的導航欄在swift3
- 2. 陰影變色導航欄
- 3. Android:從底部導航中刪除陰影
- 4. 底部陰影到ListPopupWindow android
- 5. 的Android - 導航欄取代我的底部導航欄
- 6. 導航欄隱藏NestedScrollView的底部[Android]
- 7. Appcelerator Android新底部導航欄
- 8. Pinterest導航欄框陰影css
- 9. 與添加一個陰影導航欄
- 10. 如何刪除導航欄的陰影
- 11. 創建底部導航欄
- 12. jQuery Mobile底部導航欄
- 13. 導航欄飛到底部
- 14. Android底部導航
- 15. 如何在底部增加圓形陰影導航
- 16. Android:將陰影應用於ImageView底部
- 17. Android - 底部導航視圖和導航欄內的片段
- 18. 缺少導航欄和底部欄
- 19. CollectionView底部的陰影
- 20. 如何陰影底部
- 21. UINaviguationBar底部陰影消失
- 22. 導航欄狀態,顯示和隱藏底部導航欄
- 23. 的Android底部導航
- 24. Google即時狀態欄和導航欄上的漸變/陰影
- 25. 導航控制器底部欄
- 26. 導航欄顯示在底部
- 27. 導航欄在底部居中 - CSS
- 28. jQuery Mobile的導航欄底部
- 29. 塑造導航欄的底部邊框
- 30. Highcharts,放大底部導航欄
的最佳解決方案。謝謝。 – Ahsan
適合與舊版Android兼容 –