【发布时间】:2018-05-11 04:07:21
【问题描述】:
大家好,我想要一个屏幕高度为 30% 的图像视图,我该怎么做?这是我的代码,但是当我更改约束布局高度以匹配父级时它不起作用,当我将它设置为 wrap_content 现在我在屏幕上什么都没有 这是我的代码:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.AppCompatImageView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="@+id/guideline1"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/pic" />
<android.support.constraint.Guideline
android:id="@+id/guideline1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.25"/>
</android.support.constraint.ConstraintLayout>
【问题讨论】:
-
@Osairon 它不工作我试试这个
标签: android android-layout android-constraintlayout