Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在相对布局中绘制水平线而不创建扩展 View 且没有 XML 的类?我需要在笛卡尔平面的给定点的 RelativeLayout 中绘制一条简单的线
你可以试试这个:
View line = new View(this); line.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, 1)); line.setBackgroundColor(Color.rgb(51, 51, 51)); layout.addView(line);
还有其他方法也可以通过油漆。