ImageView在Android中无法使用布局

问题描述 投票:0回答:1

图像不符合版面设计,没有显示在版面设计中。我已经更改了布局宽度设置,但没有更改,并且图像仍在屏幕外。

<?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>

我想要类似

android android-xml
1个回答
0
投票

您应该这样使用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"
            >
© www.soinside.com 2019 - 2024. All rights reserved.