如何在Android中实现一个点击切换视图并跳转传值功能

介绍

本文章向大家介绍如何在Android中实现一个点击切换视图并跳转传值功能的基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

1, MainActivity xml的布局
& lt; ?xml version=?.0”;编码=皍tf-8" ?在
& lt; LinearLayout xmlns: android=癶ttp://schemas.android.com/apk/res/android"
,,,xmlns:应用=癶ttp://schemas.android.com/apk/res-auto"
,,,xmlns:工具=癶ttp://schemas.android.com/tools"
,,,android: layout_width=癿atch_parent"
,,,android: layout_height=癿atch_parent"
,,,android:取向=皏ertical"
,,,工具:上下文=?MainActivity"祝辞

,,& lt; com.example.tiamo.weeklianxi.view.HeadView
,,,,,,android: id=癅 + id/headview"
,,,,,,android: layout_width=癿atch_parent"
,,,,,,android: layout_height=皐rap_content"祝辞

,,& lt;/com.example.tiamo.weeklianxi.view.HeadView>
,,,& lt; LinearLayout
,,,,,,,android: layout_width=癿atch_parent"
,,,,,,,android: layout_height=皐rap_content"
,,,,,,,android:取向=癶orizontal"
,,,,,,,在
,,,,,,,& lt;按钮
,,,,,,,,,,,android: layout_width=? dp"
,,,,,,,,,,,android: layout_height=皐rap_content"
,,,,,,,,,,,android: layout_weight=?“
,,,,,,,,,,,android:背景=? fff"
,,,,,,,,,,,android:文本=跋俊?br/>,,,,,,,,,,,/在
,,,,,,,& lt;按钮
,,,,,,,,,,,android: layout_width=? dp"
,,,,,,,,,,,android: layout_height=皐rap_content"
,,,,,,,,,,,android: layout_weight=?“
,,,,,,,,,,,android:背景=? fff"
,,,,,,,,,,,android:文本=跋俊?br/>,,,,,,,,,,,/在
,,,,,,,& lt;按钮
,,,,,,,,,,,android: layout_width=? dp"
,,,,,,,,,,,android: layout_height=皐rap_content"
,,,,,,,,,,,android: layout_weight=?“
,,,,,,,,,,,android:背景=? fff"
,,,,,,,,,,,android:文本=跋俊?br/>,,,,,,,,,,,/在
,,,,,,,& lt;按钮
,,,,,,,,,,,android: layout_width=? dp"
,,,,,,,,,,,android: layout_height=皐rap_content"
,,,,,,,,,,,android: layout_weight=?“
,,,,,,,,,,,android:背景=? fff"
,,,,,,,,,,,android:文本=跋俊?br/>,,,,,,,,,,,/在
,,,& lt;/LinearLayout>

& lt; com.jcodecraeer.xrecyclerview.XRecyclerView
,,,android: id=癅 + id/xresycle"
,,,android: layout_width=癿atch_parent"
,,,android: layout_height=癿atch_parent"祝辞

& lt;/com.jcodecraeer.xrecyclerview.XRecyclerView>

& lt;/LinearLayout>
1
2
3
4
5
6

7 8 9

10
11
12
13
14
15 16

17
18 19

20
21

22日23日24


25日26日

27 28 29

30 31

32 33


34 35
36 37

38 39

40
42 41

43 44

45 46

47
48 49

50 51

52
53
54
55 56

57
58
2。null

如何在Android中实现一个点击切换视图并跳转传值功能