android 如何使用 imageview 在标签栏下方放置图像?
How to place a image using imageview below tabbed bar in android?
我正在使用约束布局。当我在图像视图中放置图像时,它直接垂直对齐屏幕中心,标签栏和图像之间有巨大的 space。我不能把它正好放在选项卡下面 bar.The 图片分辨率是 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
要将您的图片放在选项卡下方,您可以使用 "android:scaleType="fitStart”。它会将您的图片置于顶部,
不影响任何纵横比。
<android.support.constraint.ConstraintLayout
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="match_parent">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/section_label"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginTop="0dp"
android:scaleType="fitStart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/flower" />
</android.support.constraint.ConstraintLayout>
我正在使用约束布局。当我在图像视图中放置图像时,它直接垂直对齐屏幕中心,标签栏和图像之间有巨大的 space。我不能把它正好放在选项卡下面 bar.The 图片分辨率是 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
要将您的图片放在选项卡下方,您可以使用 "android:scaleType="fitStart”。它会将您的图片置于顶部, 不影响任何纵横比。
<android.support.constraint.ConstraintLayout
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="match_parent">
<android.support.v7.widget.AppCompatImageView
android:id="@+id/section_label"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginBottom="0dp"
android:layout_marginLeft="0dp"
android:layout_marginRight="8dp"
android:layout_marginTop="0dp"
android:scaleType="fitStart"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/flower" />
</android.support.constraint.ConstraintLayout>