【发布时间】:2020-05-31 21:24:11
【问题描述】:
我实际上需要解决这个问题,我做了一个活动,我拍摄了两张不同比例的不同图像,当我将两张图像放入其中时,只有一张显示为什么我已经做了一些修复,它们是 android:adjustViewBonds =true 等等,但它不起作用,我使用的是 URI 而不是 Bitmap 任何建议如何修复我做了所有可用的方法 上面是 xml 文件,您可以在约束布局中看到两个图像,当我保持任何图像的比例时,图像 1 的比例为 1:1,图像 2 的比例为 13:3 或类似的东西 所有这一切都不起作用只有一张图像显示任何建议如何使它工作谢谢 谢谢...任何问题请询问:)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="600dp"
android:orientation="vertical">
<TextView
android:id="@+id/hgfgfh"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@color/common_google_signin_btn_text_dark_default"
android:gravity="center"
android:maxLines="1"
android:textSize="23sp"
android:textAlignment="center"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="57dp"
android:orientation="horizontal">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/fdgfdg"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_margin="10dp"/>
<TextView
android:layout_width="172dp"
android:layout_height="31dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="8dp"
android:text="ghfhgf"
android:textColor="#000000"
android:textSize="16sp" />
<ImageView
android:id="@+id/textView2"
android:layout_width="37dp"
android:layout_height="32dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="70dp"
android:src="@drawable/moreitems_foreground" />
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/image1"
android:layout_width="198dp"
android:layout_height="302dp"
android:layout_centerInParent="true"
android:adjustViewBounds="true"
android:maxWidth="39dip"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintTop_toTopOf="parent" />
<ImageView
android:id="@+id/image2"
android:layout_width="198dp"
android:layout_height="302dp"
android:adjustViewBounds="true"
android:maxWidth="39dip"
android:layout_centerInParent="true"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0" />
</androidx.constraintlayout.widget.ConstraintLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="48dp"
android:padding="8dp">
<ImageView
android:layout_width="38dp"
android:layout_height="33dp"
android:id="@+id/view"
android:background="@drawable/border"
android:src="@drawable/view_v_foreground" />
<Button
android:id="@+id/like"
android:layout_width="35dp"
android:layout_height="36dp"
android:layout_marginStart="43dp"
android:background="@drawable/ic_fd_foreground"
android:backgroundTint="@color/blue"
android:focusedByDefault="true" />
<ImageView
android:id="@+id/save"
android:layout_width="36dp"
android:layout_height="32dp"
android:layout_alignParentEnd="true"
android:src="@drawable/pump" />
</RelativeLayout>
<TextView
android:id="@+id/sdfsdf"
android:layout_width="411dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginBottom="1dp"
android:text="Vsdfs"
android:textColor="@color/blue" />
<ImageView
android:layout_width="36dp"
android:layout_height="33dp"
android:layout_marginTop="8dp"
android:src="@drawable/ic_rfgfdrt_foreground" />
</LinearLayout>
</RelativeLayout>
【问题讨论】:
标签: java android xml kotlin layout