program story

내용을 감싸지 않는 이미지보기

inputbox 2020. 12. 6. 21:30
반응형

내용을 감싸지 않는 이미지보기


이 이미지를 래핑하는 ImageView가 있습니다 .

<ImageView
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:scaleType="fitStart"
    android:src="@drawable/oncmap"/>

바로 아래에 TextView가 있습니다. 불행히도 장치의 화면 크기에 따라보기를 아래로 내리거나보기 밖으로 밀어냅니다.

http://i.imgur.com/CuVFK5P.png

http://i.imgur.com/6wzMebV.jpg

나는 그것을 "해킹"할 수 있지만 차라리 ...

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="16dp"
android:orientation="vertical"
tools:context="MapFragment">

<ImageView
    android:layout_height="wrap_content"
    android:layout_width="wrap_content"
    android:src="@drawable/oncmap"/>

<TextView
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:text="Neptune"
    style="@style/sectionHeader"/>

<TextView
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:paddingLeft="8dp"
    android:paddingRight="8dp"
    android:paddingTop="16dp"
    android:text="@string/info"
    style="@style/text"/>


ImageView에 다음 필드를 추가합니다.

android:scaleType="fitXY"
android:adjustViewBounds="true"

참고 URL : https://stackoverflow.com/questions/21203189/image-view-not-wrapping-contents

반응형