自定义形状到PopupWindow

时间:2016-07-01 09:12:25

标签: android

如何实现PopupWindow形状,如下面的屏幕截图所示?

我了解如何使用描边/纯色创建Rectangle形状。

我知道如何玩角落,但如何在<标签附近实施箭头Close

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:bottom="@dimen/edittext_border"
        android:left="@dimen/edittext_border"
        android:right="@dimen/edittext_border"
        android:top="@dimen/edittext_border">
        <shape android:shape="rectangle">
            <stroke
                android:width="@dimen/edittext_border_width"
                android:color="@color/divider_color_light" />

            <solid android:color="@color/white" />
        <padding android:bottom="@dimen/awsome_edittext_padding" android:left="@dimen/awsome_edittext_padding" android:right="@dimen/awsome_edittext_padding"/>

        </shape>
    </item>

</layer-list>

http://image.prntscr.com/image/bbf2cd75410d4f4986b1e28f11b741b3.png

2 个答案:

答案 0 :(得分:0)

你可以使用.9补丁png作为PopupWindow的背景。

enter image description here 如下面的代码`

 <FrameLayout
            android:id="@+id/popupbg"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@drawable/POPUPBACkGROUND" >
</FrameLayout>

您可以参考此site!

答案 1 :(得分:0)

您可以在自定义弹出窗口中准确设置该类型的背景   看到这个图书馆      https://github.com/kvirair/Quick-Action