我如何使用xml在Android中绘制这个形状?

时间:2023-02-09 23:50:54

I'm porting one of my iOS apps over to Android (which I'm pretty new to), and I was wondering how I would draw this shape in Android using XML:

我将我的一个iOS应用程序移植到Android(我很新手),我想知道如何使用XML在Android中绘制这个形状:

我如何使用xml在Android中绘制这个形状?

I want to recreate the shape (the white object) at the bottom of a tableView. The image attached is a screenshot of the bottom of a UITableView.

我想重新创建tableView底部的形状(白色对象)。附加的图像是UITableView底部的屏幕截图。

Any help would be greatly appreciated if you need any more info just let me know.

如果您需要更多信息,我们将非常感谢您的帮助。

Thanks

EDIT:

Sorry I wasn't totally clear, I'm actually trying to recreate the slight arch at the bottom of the table. Since it's so slight, you may not be able to see it with a quick glance.

对不起,我不是很清楚,我实际上是想重新创建桌子底部的轻微拱门。由于它很轻微,你可能无法快速浏览它。

2 个解决方案

#1


0  

It seams to me that you want to "lift" your table up a little bit. If so, you have to implement this attribute to your tableView:

我联系到你想要把你的桌子“抬起”一点点。如果是这样,您必须将此属性实现到tableView:

android:elevation="2dp"

or in java:

或者在java中:

tableview.setElevation(2);

#2


0  

My opinion when reading this question: Stop trying to make your android apps look like iOS apps !!!

我在阅读这个问题时的意见:停止尝试使您的Android应用程序看起来像iOS应用程序!

If you still want to do it. Just have the background color for your activity to that color and set the layout_margin to either 2 or 4. It should give you your desired effect.

如果你还想这样做的话。只需将活动的背景颜色设置为该颜色,并将layout_margin设置为2或4.它应该为您提供所需的效果。

#1


0  

It seams to me that you want to "lift" your table up a little bit. If so, you have to implement this attribute to your tableView:

我联系到你想要把你的桌子“抬起”一点点。如果是这样,您必须将此属性实现到tableView:

android:elevation="2dp"

or in java:

或者在java中:

tableview.setElevation(2);

#2


0  

My opinion when reading this question: Stop trying to make your android apps look like iOS apps !!!

我在阅读这个问题时的意见:停止尝试使您的Android应用程序看起来像iOS应用程序!

If you still want to do it. Just have the background color for your activity to that color and set the layout_margin to either 2 or 4. It should give you your desired effect.

如果你还想这样做的话。只需将活动的背景颜色设置为该颜色,并将layout_margin设置为2或4.它应该为您提供所需的效果。