Android : Layout with height wath_parent inside scrollview

on Tuesday, March 31, 2015


I need place three FrameLayouts with height equal to the height of the screen inside scrollView.


This picture shows the problem.



<scrollView>
_____________ ______________
| screen | | |
| | | FL1 |
| | | |
| | | |
| | | |
_____________ ______________
______________
| |
| FL2 |
| |
| |
| |
______________
______________
| |
| FL3 |
| |
| |
| |
______________
</scrollView>


This is my code. I tried to use Relative Layout. Maybe there is solving this Linear Layout. I could not do it.



<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true">

<RelativeLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center">

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:id="@+id/frameLayout1"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>


<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/background_light"
android:orientation="vertical"
android:layout_below="@+id/frameLayout1"
android:id="@+id/frameLayout2"/>

<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black"
android:orientation="vertical"
android:layout_below="@+id/frameLayout2"
/>

</RelativeLayout>
</ScrollView>


Framelayouts do not have height equals of screen, how to fix it?


0 comments:

Post a Comment