利用.9图做背景,配合使用popwindow和listview可以实现这个需求,也可以自定义popwindow的布局,画边框加阴影,自定义三角形的view,然后...然后我就放弃了这个思路,老老实实直接让设计师给我切图了。andriod开发中写个阴影都要几十行xml代码,不像H5开发,一行css代码搞定了,反正我是受不了,怎么方便怎么来。
最终效果图如下:
直接把切好的图(png格式)放进对应的drawable文件(分辨率不同)中,然后右键png文件,选中create 9-patch file这个选项,进入.9图编辑
其实.9图就是适应图片在各个可能拉伸变形的情景中用的
编辑四条边,该拉伸的地方调整一下,不希望它拉伸的地方不要选中,就ok了
创建popwindow布局文件
xmlns:app\="http://schemas.android.com/apk/res-auto"
android:orientation\="vertical"
android:layout\_width\="match\_parent"
android:layout\_height\="match\_parent"\>
android:id\="@+id/list"
android:layout\_width\="fill\_parent"
android:layout\_height\="wrap\_content"
android:divider\="#e8e9e8"
android:scrollbars\="none"
android:dividerHeight\="1dp"
android:overScrollMode\="never"
app:layout\_constraintBottom\_toBottomOf\="parent"
app:layout\_constraintEnd\_toStartOf\="parent"
app:layout\_constraintStart\_toEndOf\="parent"
app:layout\_constraintTop\_toTopOf