惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
有赞技术团队
有赞技术团队
Vercel News
Vercel News
Engineering at Meta
Engineering at Meta
Hugging Face - Blog
Hugging Face - Blog
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
罗磊的独立博客
Blog — PlanetScale
Blog — PlanetScale
Microsoft Security Blog
Microsoft Security Blog
B
Blog RSS Feed
H
Help Net Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
V
Visual Studio Blog
B
Blog
MongoDB | Blog
MongoDB | Blog
T
The Blog of Author Tim Ferriss
L
LangChain Blog
D
Docker

博客园 - gwazy

wifi zigbee 蓝牙区别 easyui textbox 获取焦点 easyUI 异步加载树 sql 有条件计数 easyui combox 手动添加项 只有设置了 name 属性的表单元素才能在提交表单时传递它们的值 除湿方法 android 页面跳转,数据回传 android studio 乱码 android studio 工具 gridlaylout 简单布局 android sdk 重装windows7企业版时提示“安装程序无法创建新的系统分区,也无法定位现有系统 csdn 泄露用户密码害人不浅啊。 PoolMon 使用 固态硬盘相关知识 android 平台搭建 win8 中使用第三方无线网卡出现无线连接受限解决办法 iis 故障导致网站无法访问
android 开发 简单的页面布局
gwazy · 2015-04-23 · via 博客园 - gwazy
package com.example.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

public class MainActivity extends Activity {



        // 当第一次创建该Activity时回调该方法
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            // 创建一个线性布局管理器
            LinearLayout layout = new LinearLayout(this);
            // 设置该Activity显示layout
            super.setContentView(layout);
            layout.setOrientation(LinearLayout.VERTICAL);
            // 创建一个TextView
            final TextView show = new TextView(this);
            // 创建一个按钮
            Button bn = new Button(this);
            bn.setText(R.string.ok);
            bn.setLayoutParams(new ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.WRAP_CONTENT,
                    ViewGroup.LayoutParams.WRAP_CONTENT));
            // 向Layout容器中添加TextView
            layout.addView(show);
            // 向Layout容器中添加按钮
            layout.addView(bn);
            // 为按钮绑定一个事件监听器
            bn.setOnClickListener(new OnClickListener()
            {
                @Override
                public void onClick(View v)
                {
                    show.setText("Hello , Android , " + new java.util.Date());
                }
            });

    }
}

      eclipse 真难用啊。

posted on 2015-04-23 22:44  gwazy  阅读(734)  评论()    收藏  举报