android - Map fragment filling almost all the screen -


i trying share height of screen's layout between mapfragment , simple textview, in such way small textview @ bottom of screen takes space needs, while googlemap fragment fills rest of available screen.

like this:

enter image description here

the problem able obtain such result statically specifying fragment's android:layout_height @ 450dp, , haven't found way dynamically, layout adapt both landscape mode , mobiles different screen sizes.

this i've tried do:

<scrollview xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_height="match_parent"     android:layout_width="match_parent" tools:context="madapps.bicitourbo.detailsfragmenttwo">      <linearlayout android:id="@+id/map"         android:layout_height="wrap_content" android:layout_width="match_parent"         android:orientation="vertical"         android:weightsum="10">         <!--android:paddingright="16dp"-->         <!--android:paddingleft="16dp"-->          <fragment xmlns:android="http://schemas.android.com/apk/res/android"             android:id="@+id/mapfrag"             android:layout_height="0dp"             android:layout_width="match_parent"             android:layout_weight="9"             android:name="com.google.android.gms.maps.mapfragment"/>          <textview android:id="@+id/headertitle"             android:gravity="center_horizontal"             android:layout_height="0dp"             android:layout_width="match_parent"             android:text="partenza da: piazza santo stefano"             android:textsize="@dimen/textsizebig" android:textcolor="@color/textlightblack"             android:layout_marginbottom="16dp"             android:layout_margintop="16dp"             android:layout_weight="1"/>     </linearlayout>  </scrollview> 

and unwanted outcome:

enter image description here

<scrollview xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_height="match_parent" android:layout_width="match_parent" tools:context="madapps.bicitourbo.detailsfragmenttwo">  <linearlayout android:id="@+id/map"     android:layout_height="match_parent" android:layout_width="match_parent"     android:orientation="vertical"     android:weightsum="10">     <!--android:paddingright="16dp"-->     <!--android:paddingleft="16dp"-->      <fragment xmlns:android="http://schemas.android.com/apk/res/android"         android:id="@+id/mapfrag"         android:layout_height="0dp"         android:layout_width="match_parent"         android:layout_weight="9"         android:name="com.google.android.gms.maps.mapfragment"/>      <textview android:id="@+id/headertitle"         android:gravity="center_horizontal"         android:layout_height="wrap_content"         android:layout_width="match_parent"         android:text="partenza da: piazza santo stefano"         android:textsize="@dimen/textsizebig" android:textcolor="@color/textlightblack"         android:layout_marginbottom="16dp"         android:layout_margintop="16dp"          android:layout_weight="1"/> </linearlayout> 

the android:weightsum gives linearlayout total weight of 10.

so fragment gets 9/10 of linearlayout, , textview gets 1/10 of layout.


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

Kivy: Swiping (Carousel & ScreenManager) -