ImageView выходит из макета в Android - PullRequest
0 голосов
/ 23 апреля 2020

Изображение исчезает с макета и не отображается на макете. Я изменил настройки ширины макета, но без изменений, и изображение по-прежнему за кадром.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginRight="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="10dp"
        android:orientation="horizontal"
        android:background="@drawable/statis_tag_list"
        >
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            >
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="This Is Awesome Title Tag"
            ></TextView>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:adjustViewBounds="true"
                android:scaleType="fitStart"
                android:text="Awesome Description tag that list the important information"></TextView>
        </LinearLayout>

        <ImageView
            android:layout_width="100dp"
            android:layout_height="100dp"
            android:adjustViewBounds="false"
            android:src="@drawable/tag"></ImageView></LinearLayout>
</LinearLayout>

Я хочу что-то вроде

1 Ответ

0 голосов
/ 23 апреля 2020

Вы должны использовать layout_weight так:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        //....
        >
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="1" // use layout weight
            android:orientation="vertical"
            >
...