景观ViewPager [英] Landscape ViewPager

查看:189
本文介绍了景观ViewPager的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我改变我的orientationon景观我的照片将只有一半......我想,当我改变我的方向是像在Facebook上,展现全貌。

When I change my orientationon landscape my photo will be only half ... I want when I change my orientation to be like on facebook , to show full picture .

<?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:orientation="vertical" >

<android.support.v4.view.ViewPager
    android:id="@+id/pager"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
   />

推荐答案

您需要创建另一个布局水平布局。如果你希望你的纵向视图是从横向视图不同。你必须创建另一个 XML 文件的风景线。
这两个 XML 文件将被同一个Java code处理。虽然你可以通过编程聆听方位的变化,但将preFER不同的布局不同的方向。

You have to create another layout for horizontal layout. if you want your portrait view to be different from your landscape view. you must create another XML file for landscape. The two XML file will be handled by the same JAVA code. although you can programmatically listen to orientation change but would prefer the different layout for Different Orientation.

创建两种类型的布局目录的处理方向。布局用地布局端口把XML在这两个目录的名称相同。例如,如果你有main.xml中的文件然后添加必须把它在这两个目录。

create two types of layout directories to handle orientation . layout-land layout-port put the xml with the same name in both the directory. example if you have main.xml file then add have to put it in both directory.

上支持多个屏幕文档

这篇关于景观ViewPager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆