我的应用程序中有一个 SlidingPaneLayout,我希望它看起来或多或少像环聊一样。I show a list of elements on the left and the detail on the right pane, overlapping when an element is selected.
这就是我在 Galaxy Nexus 上看到的,这正是我想要看到的:
现在,这就是我在旧 Galaxy S 上得到的:
代码非常简单:
<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>
如何使两个设备上的布局看起来非常相似?如您所见,我尝试添加一些权重,但没有奏效。