Scale Down (or Crop) Dialog Background In Android
I have a high res image (let's say 1900x1200), which I want to use as background for my dialog. It is created Dialog dialog = new Dialog(this); dialog.setContentView(R.layo
Solution 1:
The solution idea comes from here: How to wrap content views rather than background drawable?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageView
android:src="@drawable/back_dialog"
android:scaleType="fitXY"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_alignTop="@+id/dialog_layout_main"
android:layout_alignBottom="@id/dialog_layout_main"
android:layout_alignLeft="@id/dialog_layout_main"
android:layout_alignRight="@id/dialog_layout_main" />
<LinearLayout
android:id="@+id/dialog_layout_main"
android:layout_width="match_parent"
android:layout_height="wrap_content">
.........
</LinearLayout>
</RelativeLayout>
Post a Comment for "Scale Down (or Crop) Dialog Background In Android"