横向ViewPager
Landscape ViewPager
当我改变我的横向方向时,我的照片将只有一半...我希望当我改变我的方向时像在 facebook 上一样,显示全图。
<?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 代码处理。虽然您可以通过编程方式收听方向变化,但更喜欢不同方向的不同布局。
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.
当我改变我的横向方向时,我的照片将只有一半...我希望当我改变我的方向时像在 facebook 上一样,显示全图。
<?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 代码处理。虽然您可以通过编程方式收听方向变化,但更喜欢不同方向的不同布局。
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.