我有一个imageview &相对布局,其中包含两个按钮的布局应该与底部对齐,并且圆形图像应伸展以占用剩余空间。我尝试了其他答案,但无法做到这一点。我有下面的代码和图像。如何将特定布局对齐到底部并修复imageview的大小以覆盖剩余空间?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/cardview_light_background"
android:clickable="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="@layout/toolbar_child_with_progress"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/toolbar_child"/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/toolbar_child">
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/iv_SavedInvoice"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@drawable/service_app_logo"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:layout_centerHorizontal="true"
/>
<LinearLayout
android:id="@+id/ll_inner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_below="@+id/iv_SavedInvoice"
android:layout_alignParentBottom="true"
>
<Button
style="@style/PrimaryButton"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/form_proof_replace_invoice"
android:id="@+id/button_ReplaceInvoice" />
<Button
style="@style/NoBorderButton"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/form_proof_next"
android:id="@+id/button_SavedProofNext" />
</LinearLayout>
</RelativeLayout>
</ScrollView>
</RelativeLayout>
谢谢,scrollview是罪魁祸首。其实我有一些其他的代码,我没有发布。我在scrollview之上移动了布局,并且它正在工作。 –
你能否帮我一个小忙。我已经使用“fitXY”来适应图像的高度以覆盖按钮上的高度间隙。如何保持横向图像的纵横比并将图像的宽度发送出屏幕? –
与centerCrop重新镶嵌xY。它将保持长宽比。但它会使一些地区crop。。如果它很好,试试这个。或者可以尝试一些ImageView的库。 –