平板电脑布局,使用肖像片段,而不是风景布局
问题描述:
我目前正在为我的音乐应用程序设计一个平板电脑布局。平板电脑布局,使用肖像片段,而不是风景布局
手机版本有两种不同的音乐播放器片段布局,一个用于肖像,一个用于横向。 我有另一个显示当前播放列表中的歌曲的fragement。
对于平板电脑横向布局,我想显示纵向播放器布局和播放列表。
这是平板电脑布局资源:
<?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>
我的问题是,机器人展示了片段“playerFragment”的景观布局。我如何强制他显示肖像版本?
在此先感谢。
问候, Asfaloth
答
你可以强制任何活动在横向或纵向显示从AndroidManifest.xml中
<activity android:name="youractivity" android:screenOrientation="portrait" ></activity>
我不想强迫横向整个活动,只为一个分段。 – amuttsch 2013-03-23 18:16:18