Q
颜色与线条
-3
A
回答
2
要实现对角线的背景,只需在Paint或Photoshop中创建一个单独的小行。将其保存在Drawable文件夹中。
现在创建一个XML drawable。
diagonal_background.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/DiagonalLine"
android:tileMode="repeat"
android:dither="true"
>
</bitmap>
在您的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="your_color"
>
<ImageView
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@drawable/diagonal_background"
android:visibility="gone"/> <---- set it to gone and call it under an if-else statement
</LinearLayout>
编辑
您可以使用此设置查看从绘制背景:
layout.setBackground(ContextCompat.getDrawable(context, R.drawable.diagonal_background));
相关问题
- 1. SVG:线条颜色
- 2. 将箭头颜色与D3中的线条颜色相匹配
- 3. CSS:线条通过与文本颜色不同的颜色?
- 4. Android:删除线条颜色
- 5. Raphael:设置线条颜色
- 6. 有条件地设置线条颜色
- 7. 地块与集线颜色与显示颜色略有不同
- 8. 如何在颜色表中的颜色之间插入线条?
- 9. 从绿盘Quantmod ChartSeries中线条颜色到另一种颜色
- 10. řmatplot匹配图例颜色线条颜色
- 11. 更改图形线条颜色
- 12. CoreGraphics的一条线的颜色渐变
- 13. 在TChart中设置线条颜色
- 14. DropMode.INSERT_ROW中线条标记的颜色
- 15. OHLC图表的线条颜色
- 16. 等高线连续的颜色条
- 17. 如何更改seaborn线条颜色lmplot
- 18. Qplot线条颜色和图例美学
- 19. UINavigationBar中的自定义线条颜色
- 20. Actionbarsherlock - 更改操作栏线条颜色
- 21. Teechart HTML5,线条颜色和厚度
- 22. GNUPLOT:boxplots可变线条样式/颜色
- 23. C3.js线条图颜色来自URL
- 24. Highcharts - 无法更改线条颜色
- 25. Matplotlib:轮廓线作为颜色条中的线条
- 26. UINavigation条颜色
- 27. 与R中的点不同的线条颜色
- 28. 如何使文本颜色与通知颜色条匹配?
- 29. 实体与渐变条纹颜色
- 30. 有条件的颜色与matplotlib散射
你应该在这里发布图像,而不是在外面托管它,所以我们肯定是不会离线 – rakwaht
我在堆栈托管图像,但我没有15的声望 – xyz
简单**瓦**一个红色正方形如@Abhi所建议的那样,采用对角黑线。 –