Android的按钮打开XML布局 [英] Android Button to open xml layout

查看:116
本文介绍了Android的按钮打开XML布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是很新的android开发,并希望与三页,并在其上​​的按钮导航到不同的页面的主页创建一个应用程序。我已创建了不同的XML网页,我相信我一定要建立某种形式的的onclick事情,但即时通讯不确定。

Hi I'm very new to android development, and want to create an app with three pages and a main page with buttons on it navigating to the different pages. I have create the different xml pages and I believe I have to create some sort of onclick thing but im unsure.

code什么的java我需要的,还有什么我需要添加到正常的按钮XML等任何人都可以请告诉我一个例子落实到我的照片的工作,请

What java code do I need, what else to I need to add to the normal button xml etc. can anyone please show me an example to implement into my work with pictures please

这是我的一个按钮

<Button
  android:id="@+id/information"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:textColor="#fff"
  android:background="@drawable/custombutton"
  android:text="Information  >"
  android:textSize="18dp"
  android:layout_marginBottom="2dp"
  />

这是唯一的java文件我有(做我到这个或作出新的)

This is the only java file I have (do i add to this or make new one)

package com.techie.layout;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import reading.festival.guide.R;

public class LayoutPractice extends Activity {

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

//makes full screen and takes away title bar
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
//

setContentView(R.layout.linear);
}

}

我的其他XML布局被称为地图,信息和阵容原始XML被称为线性的。

My other xml layouts are called sitemap, information, and lineup the original xml is called linear.

我希望我已经提供了足够的人的信息,帮助我,我敢肯定,它很容易和IM愚蠢

I hope I have provided enough information for someone to help me, im sure its very easy and im being stupid

欢呼声

推荐答案

所以,当你说页面你的意思是活动。你需要为每个布局文件的创建活动。

So when you say "pages" you mean Activities. You'll need to create an activity for each of your layout files.

阅读材料:
http://developer.android.com/guide/topics/fundamentals/activities.html

这篇关于Android的按钮打开XML布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆