java - Android : LinearLayout with weight inside a ScrollView -


i'm having frustrating issue scrollview, here hierarchy :

scrollview (vertical)     linearlayout (vertical)         imageview weight= 0.5         whatever weight= 0.1         whatever weight= 0.2         whatever weight= 0.2 

if remove scrollview (and let linearlayout main item), work image : image takes 50% of screen size, , other views take fill rest.

however, when scrollview here, "weight" parameter ignored if image tall : image can fit screen width, , tall , take more 50% of screen. edit : actually, "weight" attributes seem ignored :

without scrollview: enter image description here

with scrollview: enter image description here

i want linear layout fit without having scrolling. possible ? i've tried change of image option (scaletype, adjustviewbounds) didn't manage have wanted.

here's whole xml :

<?xml version="1.0" encoding="utf-8"?>  <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true">  <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:orientation="vertical"     android:weightsum="1">       <imageview         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.5"         android:adjustviewbounds="true"         android:src="@drawable/testing" />      <button         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.2"         android:text="i'm test" />      <button         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.1"         android:text="i'm test" />      <button         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="0.2"         android:text="i'm test" />  </linearlayout> </scrollview> 

note : need scrollview because i'm using pulltorefresh scrollview

i solved adding parent linear layout (and main relativelayout) :

    scrollview (vertical)         linealayout             linearlayout (vertical)                 imageview weight= 0.5                 whatever weight= 0.1                 whatever weight= 0.2                 whatever weight= 0.2 

and setting programmatically height of child linearlayout height of screen childlinearlayout.getlayoutparams().height


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -