【发布时间】:2012-07-11 15:24:38
【问题描述】:
嗨,我是 android 新手,花了 10 多个小时寻找这个答案,但我似乎无法找到并理解它。我在主 xml 页面。我正在尝试创建一个转到另一个页面的按钮。我需要最简单和最简单的方法来做到这一点。有人可以帮帮我吗?这是我的主要 xml 代码。
<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" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:padding="@dimen/padding_medium"
android:text="@string/hello_world"
tools:context=".MainActivity" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_centerHorizontal="true"
android:layout_marginTop="66dp"
android:text="Button" />
</RelativeLayout>
【问题讨论】:
-
您可以通过转到@OvidiuLatcu 发布的链接来节省时间。总是去 developer.android.com 如果你没有找到你的答案来这里搜索一些问题,如果仍然没有,发布一个问题。
标签: android xml button onclick screen