Linear Layout Adjustment is Not Happening

156 views Asked by At

I am creating one app.I am facing a piquliear problem.I have run my app in all samsung devices,htc deivces,sony devices,tablet also.But in few of them the layout is not coming as it should be.

I am posting one screen shot over here.

enter image description here

Now u can see that after the earth image there is one gap coming after the second image.In the earth image i am using gallery view and in the horoscope image i am using grid view.Now THIS GAP is not appearing in all devices when i test but in few devices this gap is coming.Why is that ?

I am posting the layout file.

      <LinearLayout 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"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical"    
android:weightSum="2"

 >


<ListView
    android:id="@+id/mylistcat"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1" >

</ListView>

<com.origamilabs.library.views.StaggeredGridView
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:staggered="http://schemas.android.com/apk/res-auto"
    android:id="@+id/gridviewrashisuggestions"
    android:layout_width="wrap_content"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:layout_gravity="bottom"
    android:layout_marginLeft="0.5dp"
    android:layout_marginRight="0.5dp"
    android:stretchMode="columnWidth"
    staggered:drawSelectorOnTop="false"
    staggered:numColumns="1" />

Now my list view is having one list row.xml and grid view is having one image only.How can i reduce the gap?from where it is coming ? i have used layout weight= 2 and i am asgining it to listview=1 and gridview=1 then how the gap is coming ?

please help...This is the problem of one sony experia model.whose height is more but width is less.this particular layout is working fine where the height and width is almost adjusted in physical devices.Like samsung and htc.

1

There are 1 answers

4
peter.bartos On

What do you want to achieve? setting weight equally means also equal height for both elements in LinearLayout. For better understanding, where the gap comes from, try setting different background colors for individual elements.

It looks that the horoscope view is cropped because it does not have enough space due to upper view taking the half of the screen.