改变FragmentDialog弹出框大小
版权声明:本文为博主原创文章,未经博主允许不得转载。
一个很常见的支付弹出框,大概效果是这样的:
初看之下,这不就是一个普通的弹出框么,于是决定用Android官推的DialogFragment实现这种弹出框,然而,实践是检验真理唯一标准,开撸之后才发现暗藏杀招呀。如果中规中矩的一步步写下去(继承DialogFragment,重写onCreateView方法),则出来的效果:
额,貌似好尴尬呀!说好的圆角呢,说好的正方形背景呢。。。明明在xml中设置背景了呀,不管用?!
<com.zhy.autolayout.AutoLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical"
android:background="@drawable/rec_cirwhite"
tools:context=".DialogFragmentInput">
<TextView
android:id="@+id/tv_result_pay"
android:layout_width="match_parent"