首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >低分辨率的SlidingPaneLayout混乱

低分辨率的SlidingPaneLayout混乱
EN

Stack Overflow用户
提问于 2014-04-11 00:22:22
回答 1查看 137关注 0票数 0

我的应用程序中有一个SlidingPaneLayout,我希望它看起来或多或少像Hangout一样。我在左侧显示了一个元素列表,在右侧窗格中显示了详细信息,当选择一个元素时,它们会重叠。

这是我在我的Galaxy Nexus上看到的,这是我想要看到的:

现在,这是我在我的旧Galaxy S上得到的:

代码非常简单:

代码语言:javascript
复制
   <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>

如何才能使布局在两个设备上看起来完全相同?正如你所看到的,我试着添加一些权重,但不起作用。

EN

回答 1

Stack Overflow用户

发布于 2014-04-11 17:14:55

好的,看起来我设法把它修好了。

SlidingPaneLayout的内部现在看起来像这样:

代码语言:javascript
复制
        <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>

两个片段上的layout_width="match_parent“似乎都起到了作用。

我希望这能对其他人有所帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22993625

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档