我一直在寻找在android中获得圆形或圆形布局的不同方法。我确实找到了一个很好的解决方案,android卡查看。 使用
var customerData = Customers.findOne(
{'phone': phone`,'restaurants.restaurantId':Meteor.userId()`}).restaurants;
在xml中,通过添加
可以另外获得50dp x 50dp的圆形布局 card_view:cardCornerRadius="25dp"
到xml会给我没有边框或附加内容,但只是一个普通的圆形视图(对此感到满意)。然而 pre-Lolipop 看起来不错,我希望布局支持 pre-Lolipop 。所以我只是想知道是否有一种方法可以使用 pre-Lolipop 支持(而不是cardBackgroundColor="@android:color/transparent"
的圆形布局,因为圆形/圆形布局将托管子布局。)
任何帮助表示赞赏。谢谢你;
答案 0 :(得分:0)
要绘制一个圆圈,请像这样制作自己的绘图(red_circle.xml):
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:innerRadius="@dimen/none"
android:shape="ring"
android:thicknessRatio="2"
android:useLevel="false">
<solid android:color="@color/Red" />
</shape>
然后将其设置为任何布局或视图的背景:
<View android:background=@drawable/red_circle/>