Reputation: 4271
I have a SlidingPaneLayout in my application and I want it to appear more or less like Hangouts does. I show a list of elements on the left and the detail on the right pane, overlapping when an element is selected.
This is what I see on my Galaxy Nexus, which is pretty what I meant to see:
Now, this is what I get on my old Galaxy S:
The code is pretty simple:
<android.support.v4.widget.SlidingPaneLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sliding_pane_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment
android:id="@+id/list_pane"
android:name="com.towers.hotelsclickpoc.ResultsCardsFragment"
android:layout_width="400dp"
android:layout_height="match_parent"
android:layout_weight="40"
android:layout_gravity="left"></fragment>
<fragment
android:id="@+id/content_pane"
android:name="com.towers.hotelsclickpoc.DetailsFragment"
android:layout_width="450dp"
android:layout_height="match_parent"
android:layout_weight="45"
android:paddingLeft="16dp"
android:paddingRight="16dp"></fragment>
</android.support.v4.widget.SlidingPaneLayout>
How can I make the layout look pretty the same on the two devices? As you can see I tried adding some weights but didn't work.
Upvotes: 0
Views: 147
Reputation: 4271
Ok, it seems like I managed to get it fixed.
The inner part of SlidingPaneLayout now looks like this:
<fragment
android:id="@+id/list_pane"
android:name="com.towers.hotelsclickpoc.ResultsCardsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="left"></fragment>
<fragment
android:id="@+id/content_pane"
android:name="com.towers.hotelsclickpoc.DetailsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"></fragment>
it seems the layout_width="match_parent" on BOTH fragments did the trick.
I hope this will be helpful to others.
Upvotes: 0