dialog、imageView教訓總結

1.用XML設置dialog背景浮層的透明度android

<item name="android:backgroundDimAmount">0.4</item>
 
2.用XML設置imageview自適應拉伸適配大小
android:scaleType="fitXY"
 
3.對ImageView設置maxWidth與maxHeight不起做用,須要再添加一個屬性

android:adjustViewBounds="true"ide

此外對dialog的顯示隱藏問題作下總結:ui

dialog 的建立常使用 AlertDialog.Builder(context).create(), 若是是強制顯示(點擊dialog周圍,dialog不消失);則須要對dialog設置一個屬性 dialog.setCanceledOnTouchOutside(false);spa

若是須要屏蔽物理返回鍵,虛另添加一個屬性  dialog.setCancelable(false);it

相關文章
相關標籤/搜索