【问题标题】:Tablet layout, use portrait fragment instead of landscape layout平板布局,使用纵向片段而不是横向布局
【发布时间】:2013-03-23 15:05:50
【问题描述】:

我目前正在为我的音乐应用程序设计一个平板电脑布局。

手机版的音乐播放器片段有两种不同的布局,一种是纵向的,一种是横向的。 我有另一个片段显示当前播放列表中的歌曲。

对于平板电脑横向布局,我想显示纵向播放器布局和播放列表。

这是平板电脑布局的资源:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:background="@drawable/background"
  android:orientation="horizontal" >

<fragment android:name="de.qspool.clementineremote.ui.fragments.PlayerFragment"
          android:id="@+id/playerFragment"
          android:layout_weight="1"
          android:layout_width="match_parent"
          android:layout_height="match_parent" />

<LinearLayout android:id="@+id/playlistSongsFragment"
        android:layout_weight="1"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>

我的问题是,android 显示片段“playerFragment”的横向布局。如何强制他显示肖像版?

提前致谢。

您好, 芦笋

【问题讨论】:

    标签: java android layout fragment


    【解决方案1】:

    您可以从 AndroidManifest.xml 强制任何活动以横向或纵向显示

     <activity android:name="youractivity" android:screenOrientation="portrait" ></activity>
    

    【讨论】:

    • 我不想为整个活动强制横向,只为一个片段。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多