简体   繁体   中英

linear layout not filling parent down the remaining part of the screen in a scrollview

I am designing a layout for an activity where some contents like Textview, spinner and buttons are arranged in the upper part of the screen. I want to position image view to the bottom of the screen with a match_parent attribute to fill to the remaining bottom of the screen and it has become a challenge to me as the image view is filling to the bottom of the remaining part of the screen. This is the entire layout of the upper section/part of the screen

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >


  <ScrollView
     android:layout_width="fill_parent"         
     android:background="@drawable/xxxVal"
     android:padding="10dp"
     android:layout_height="fill_parent">
  <LinearLayout
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="vertical">
   <TextView
       android:id="@+id/dataVaues"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:textSize="25sp"
        android:gravity="center_horizontal"
        android:textColor="#000"
        />
  <Spinner
      android:id="@+id/spinBundle"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_marginTop="6sp"
      android:textColor="#000"
      android:prompt="@string/_prompt" />

  <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:textColor="#000"
        android:text="Plan" />

 <TextView
    android:id="@+id/bundle"
    android:layout_height="wrap_content"
    android:layout_width="match_parent"
    android:textSize="30sp"
    android:textColor="#000"/>  

    <!-- android:inputType="phone"  -->

<TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:textColor="#000"
        android:text="PValue:" />

 <TextView
    android:id="@+id/value"
    android:inputType="value"
    android:layout_height="wrap_content"
    android:textSize="30sp"
    android:layout_width="match_parent"
    android:textColor="#000"/>  

<TextView 
        android:id="@+id/validValue"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:text="Valid:"
        android:textColor="#000000" />

  <TextView
    android:id="@+id/valid"
    android:inputType="valid"
    android:layout_height="wrap_content"
    android:textSize="30sp"
    android:layout_width="match_parent"
    android:layout_marginBottom="10dp"
    android:textColor="#ff0000"/>
  <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:gravity="center_horizontal"
                android:orientation="vertical" >

<Button 
    android:id="@+id/proceed"
    android:text="Proceed"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:textColor="#000"/>

 <Button 
    android:id="@+id/data"
    android:text="Check"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_marginTop="10dp"
    android:textColor="#000"/>
 </LinearLayout>

this is remaining part of the layout with a view flipper for an image that I want it to fit down to the remaining part of the screen but its not fitting as it shrinks up

<LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_marginTop="3dp"
                android:gravity="center_horizontal"
                android:orientation="vertical" >
      <ViewFlipper
                    android:id="@+id/flipper1"
                    android:layout_width="fill_parent"
                    android:layout_height="match_parent"
                    android:layout_centerInParent="true"
                    android:flipInterval="5000"
                    android:inAnimation="@anim/slide_in_right"
                    android:outAnimation="@anim/slide_out_left" >
                </ViewFlipper>
            </LinearLayout>


</LinearLayout>



</ScrollView>
</RelativeLayout>

please kindly assist!

Try adding the imageview to the Viewflipper like so:

<ViewFlipper
android:id="@+id/simpleViewFlipper"
android:layout_width="match_parent"
android:layout_height="wrap_content">

   <ImageView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src=IMAGE />
</ ViewFlipper >

Having said that you might find some issues regarding swiping when using a viewflipper inside a scrollview

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM