所以我有一个使用多个活动的一般布局。
名称
图像
图像的一些描述
基本上,我想在活动之间滑动,以便他们在幻灯片之后显示信息,而不是点击按钮转到活动。
我已经看了一个viewpager,但我不确定如何在每张幻灯片上都有独特的图片和独特的文字。
如何在不丢失任何布局和信息的情况下执行此操作。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/layout"
android:weightSum="1">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Name"
android:id="@+id/textView"
android:layout_gravity="center_horizontal"
android:layout_weight="0.02" />
<ImageView
android:layout_width="158dp"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_gravity="center_horizontal"
android:layout_weight="0.28" />
<TextView
android:layout_width="195dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="\nDescription"
android:id="@+id/textView2"
android:layout_weight="0.50" />
</LinearLayout></RelativeLayout>
答案 0 :(得分:0)
如果您正在查看ViewPager,我正在开发一个示例项目,展示如何使用ViewPager。如果您有兴趣,可以查看https://github.com/filippofavaro/ViewPager-Demo
答案 1 :(得分:0)
有很多种控件可以做,ViewPager,ViewFlipper,Gallery,... 您的用例不是很清楚,请先查看这些控件,或者描述用例,然后我们为您选择最佳视图。