Android的:如何实现单xml文件viewpager和看法 [英] Android: How to implement viewpager and views in single xml file
问题描述
更新:我可以使用下面的布局,以实现Viewpager 3 textviews:
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:方向=垂直> < android.support.v4.view.ViewPager
机器人:ID =@ + ID /寻呼机
机器人:layout_width =match_parent
机器人:layout_height =match_parent> <的TextView
机器人:layout_height =WRAP_CONTENT
机器人:layout_width =WRAP_CONTENT
机器人:文字=查看1/>
<的TextView
机器人:layout_height =WRAP_CONTENT
机器人:layout_width =WRAP_CONTENT
机器人:文字=查看2/>
<的TextView
机器人:layout_height =WRAP_CONTENT
机器人:layout_width =WRAP_CONTENT
机器人:文字=查看3/> < /android.support.v4.view.ViewPager>
< / LinearLayout中>
我要实现的ViewPager这些3次。我希望有viewpager和单一XML文件中的3次。每个页面都包含各自的TextView。我见过一些例子,但每一页的实现使用单独的XML布局文件。
我如何能实现在一个XML文件,这些3次的viewpager。如果可能的话,请给我一个样品code或例子。
我怎样才能实现viewpager在一个XML文件这3次。
块引用>抱歉,但这是不可能的。
UPDATED : Can I use the following layout to implement 3 textviews in Viewpager :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="view 1"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="view 2"/> <TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="view 3"/> </android.support.v4.view.ViewPager> </LinearLayout>
I want to implement the ViewPager for these 3 views. and i want to have viewpager and those 3 views in single xml file. Each page contains each textview. I have seen some examples but each page was implement using separate xml layout file.
How can I implement the viewpager for these 3 views in a single xml file. If possible please provide me a sample code or example.
解决方案How can I implement the viewpager for these 3 views in a single xml file.
Sorry, but that is not possible.
这篇关于Android的:如何实现单xml文件viewpager和看法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!