How can I set the height of an image in Visual Studio Android to show button row below image?

Viewed 21

I am developing an Android app in Visual Studio 2022 on Windows. I would like to show a row of buttons below an image shown with an imageView control for all screen dimensions and image aspect ratios and sizes. However, the image overwrites the button row if the image height is too great. I cannot see how to make the image height adjust to always show the bottom button row. If I set it to a fixed dp value it is truncated if the screen height is too small. My main.axml file is below:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <Button
        android:id="@+id/MyButton"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="Pick Image"
        android:layout_marginRight="0.0dp"
        android:layout_marginLeft="0.0dp" 
       />
    
    <ImageView
        android:src="@android:drawable/ic_menu_gallery"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="centerInside"
        android:id="@+id/imageView1"
        android:contentDescription="Image" 
    />
   
    <LinearLayout
        android:id="@+id/BottomRow"
        android:orientation="horizontal"
        android:background="@android:drawable/bottom_bar"
        android:paddingLeft="4.0dip"
        android:paddingTop="5.0dip"
        android:paddingRight="4.0dip"
        android:paddingBottom="1.0dip"
        android:layout_width="fill_parent"
        android:layout_height="44.5dp"
        android:layout_below="@+id/TextView01"
        android:layout_marginTop="0.0dp"
        android:layout_marginBottom="0.0dp">

        <Button
            android:id="@+id/allow"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
            android:text="Allow"
            android:layout_weight="1.0" />

        <Button
            android:id="@+id/deny"
            android:layout_width="0.0dip"
            android:layout_height="fill_parent"
            android:text="Deny"
            android:layout_weight="1.0" />

    </LinearLayout>
        
</LinearLayout>
0 Answers
Related