繁体   English   中英

如何用阴影创建圆形视图

[英]How to create Circular View with shadow

我需要创建像 在此处输入图片说明 并且此视图将放置为 在此处输入图片说明

我正在尝试使用框架布局来创建它,但是以失败告终。 我怎样才能做到这一点?

要么使用FrameLayout,然后将其添加为最后一个图像视图,并为此视图指定右侧和顶部布局边距,并为基础布局添加一些稍大的右侧边距。

或者是RelativeLayout,您可以使用( layout_alignParentRight="true" )并使用上边距将该视图与父右边对齐,如上例所示。

尝试模仿您的布局的示例,根据需要调整边距和图像:

此布局显示

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#bbbb00"
        android:layout_marginRight="2dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#888899"
            android:layout_margin="20dp">
        </LinearLayout>

    </LinearLayout>

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="right"
        android:layout_marginTop="80dp"
        android:src="@drawable/test"/>

</FrameLayout>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM