gpt4 book ai didi

java - 如何从底部设计圆形 View ?

转载 作者:太空宇宙 更新时间:2023-11-03 10:34:36 24 4
gpt4 key购买 nike

我正在尝试设计一个从底部看是圆形的 View ,请看图片 enter image description here

I have try different way to design, Like XML, Programatically but I am not able to get any success. I use XML code it's doing circle from bottom but when I use Any image or Banner slider as show in figure then it's hold whole view.

现在我正在使用这段代码 XML

<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:background="@drawable/bottom_radius"
android:orientation="vertical">

<ss.com.bannerslider.views.BannerSlider
android:id="@+id/bannerSlider"
android:layout_width="match_parent"
android:layout_height="match_parent" />

</LinearLayout>

bottom_radius.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<solid android:color="@color/colorPrimaryDark" />
</shape>
</item>
<item
android:bottom="4dp"
android:left="0dp"
android:right="0dp"
android:top="0dp">
<shape android:shape="oval">
<solid android:color="@android:color/white" />
</shape>
</item>

输出就像 XML 中那样 enter image description here

The XML output is looks good as I expected, but when I run the program and see the out put on the mobile or simulator then output is looks like

enter image description here

Please provide me solution so that I can design what I want to design. I will be very thank full to you.

最佳答案

android:background="@drawable/bottom_radius" 放在图像上而不是 linearlayout

关于java - 如何从底部设计圆形 View ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49249011/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com