簡體   English   中英

輸入文字時,圖像無法調整android的大小

[英]When typing in text the image is not resizing android

我的圖像波紋過大,看起來一切正常我對圖像很滿意,但是每當我單擊以鍵入軟鍵盤出現時,布局中就有文本視圖,然后占據一半的屏幕,但問題是圖像沒有縮小適應布局,結果是裁剪圖像...下面是代碼的任何想法嗎?

而且我在一個drawable中有一個圖像,而不是在不同的drawable中有任何其他大小的圖像,例如xhdpi等。

<LinearLayout>
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="tes.com">

<ImageView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:scaleType="fitXY"
    android:id="@+id/imageView"
    android:layout_alignParentTop="false"
    android:src="@drawable/image1"
    android:layout_marginTop="10dp"
    android:layout_marginBottom="70dp"
    android:layout_alignParentEnd="false"
    android:layout_alignParentStart="false"
    android:layout_alignParentLeft="false" />

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    android:layout_marginBottom="5dp"
    android:background="@drawable/bg_grd"
    android:id="@+id/LetterLayout">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="Insert Letter"
        android:id="@+id/textView2"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="30dp" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/entryText"

        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        android:maxLength="1" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="check Letter"
        android:onClick="IntroLetter"
        android:id="@+id/checkletter" />

</LinearLayout>

您面臨着經常發生的典型剪輯,請轉到清單文件,然后向此布局所屬的活動添加以下屬性

<activity
...
 android:windowSoftInputMode="stateHidden|adjustPan"
/>

您可能需要根據softInput鍵盤打開時您的活動窗口的行為來更改值

在清單中嘗試<activity android:windowSoftInputMode="adjustResize"> 它將成功。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM