【发布时间】:2017-10-14 03:09:56
【问题描述】:
我正在使用约束布局。当我在图像视图中放置图像时,它直接垂直对齐到屏幕的中心,标签栏和图像之间有巨大的空间。我不能把它放在标签栏的正下方。图像分辨率是 2048*1152。我计划将它用作我的应用程序的横幅。这是代码:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.manu.program.MainTwo">
<ImageView
android:id="@+id/imageView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:srcCompat="@drawable/banner_image"
/>
</android.support.constraint.ConstraintLayout>
当我运行应用程序时,我得到的结果如附图中所示need to remove the space between the image and tab bar
【问题讨论】:
-
在图像视图中添加 adjustViewBounds=true
-
把你的完整的xml
-
设置imageview高度wrap_content
-
为 ImageView 赋予 android:scaleType="fitXY"
-
为什么还要使用
ConstraintLayout?RelativeLayout或LinearLayout应该适用于此。
标签: android imageview android-constraintlayout