放置带有固定页脚的图像视图 android
Place imageview with fixed footer android
我想放置大约全高的图像和一个固定的页脚。
我试过这段代码。
图像使用来自图库
的动态更新
<RelativeLayout 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"
tools:context="com.aaaa.com.EditView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="8dp"
android:layout_alignParentBottom="true"
android:id="@+id/footerEdit"
android:weightSum="2">
<Button
android:id="@+id/addBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon_content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/takePhoto"
android:background="@drawable/icon_camera"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imgview"/>
</RelativeLayout>
我想将图像缩放到整个屏幕但保留页脚区域
请指导
当您使用相对布局时,您仍然可以管理 Header 和页脚(最后一个适合您)指示和布局之间的顺序。
对于您的主要内容区域,请添加:
android:layout_above="@id/lytFooter"
设置为堆叠在页脚上方
和
android:layout_below="@id/lytHeader"
设置为堆叠在您的 header 下方。
对于您的主要内容区域,将高度设置为 match_parent。
希望对您有所帮助。
我想放置大约全高的图像和一个固定的页脚。 我试过这段代码。 图像使用来自图库
的动态更新<RelativeLayout 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"
tools:context="com.aaaa.com.EditView">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
tools:layout_editor_absoluteY="0dp"
tools:layout_editor_absoluteX="8dp"
android:layout_alignParentBottom="true"
android:id="@+id/footerEdit"
android:weightSum="2">
<Button
android:id="@+id/addBackground"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/icon_content" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/takePhoto"
android:background="@drawable/icon_camera"/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imgview"/>
</RelativeLayout>
我想将图像缩放到整个屏幕但保留页脚区域 请指导
当您使用相对布局时,您仍然可以管理 Header 和页脚(最后一个适合您)指示和布局之间的顺序。 对于您的主要内容区域,请添加:
android:layout_above="@id/lytFooter"
设置为堆叠在页脚上方 和
android:layout_below="@id/lytHeader"
设置为堆叠在您的 header 下方。
对于您的主要内容区域,将高度设置为 match_parent。
希望对您有所帮助。