0
我正在向Android應用程序添加驗證碼對話框,並且難以正確確定其大小。驗證碼圖像是120x50,我希望它被放大以適應對話框的寬度。用我目前的XML,它適合寬度,但是覆蓋下面的按鈕。驗證碼對話框佈局(Android)
我的XML文件:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView android:layout_width="fill_parent"
android:layout_gravity="center"
android:id="@+id/captchaImage"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:layout_height="fill_parent"/>
</LinearLayout>
<EditText android:layout_width="fill_parent"
android:id="@+id/captchaText"
android:layout_height="wrap_content"/>
<LinearLayout android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">
<TableLayout android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="wrap_content">
<Button android:layout_width="fill_parent"
android:text="Cancel"
android:id="@+id/cancelCaptcha"
android:layout_height="wrap_content"/>
</TableLayout>
<TableLayout android:layout_width="0dp"
android:layout_weight="0.5"
android:layout_height="wrap_content">
<Button android:layout_width="fill_parent"
android:text="Submit"
android:id="@+id/submitCaptcha"
android:layout_height="wrap_content"/>
</TableLayout>
</LinearLayout>
</LinearLayout>
任何想法,我怎麼能得到120x50圖像縮放到對話框的寬度沒有覆蓋它下面什麼?
由於提前, MrGrinst
真棒,大部分的作品。現在我只需要垂直擴展對話框,因此它有足夠的空間來顯示圖像。現在圖像只是垂直壓縮。我將如何去做對話框高度更大? – MrGrinst
嘗試刪除'scaleType'屬性。 –