【发布时间】:2016-05-25 19:45:27
【问题描述】:
我使用滑动操作选项卡我有 3 个选项卡(选项卡 1、选项卡 2、选项卡 3)
如何通过单击片段android中的按钮打开新活动
在标签 1 页面中有多个按钮我想点击例如按钮 1 打开新页面我该怎么做?
如何从片段打开新页面?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#2e2e2e" >
<Button
android:id="@+id/button1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="15dp"
android:background="#00b3ff"
android:text="button 1"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="22sp"
android:textStyle="bold" />
<Button
android:id="@+id/button2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button1"
android:layout_below="@+id/button1"
android:layout_marginTop="15dp"
android:background="#00b3ff"
android:text="button 2"
android:textColor="#ffffff"
android:textColorHint="#ffffff"
android:textSize="22sp"
android:textStyle="bold"/>
</RelativeLayout>
【问题讨论】: