Android 采用代码编写ui
来源:互联网 发布:linux 启动initramfs 编辑:程序博客网 时间:2024/06/06 07:28
采用代码编写UI,省略掉资源文件
下面代码对应以下Ui:
package cn.itcast.codeui;import android.app.Activity;import android.os.Bundle;import android.view.ViewGroup;import android.widget.EditText;import android.widget.LinearLayout;import android.widget.LinearLayout.LayoutParams;import android.widget.TextView;public class DemoActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LinearLayout ll = new LinearLayout(this); ll.setOrientation(LinearLayout.VERTICAL); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,LinearLayout.LayoutParams.FILL_PARENT); ll.setLayoutParams(params); TextView tv = new TextView(this); tv.setText(R.string.hello); ll.addView(tv, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); EditText et = new EditText(this); et.setText("chao"); ll.addView(et, ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT); setContentView(ll); }}
0 0
- Android 采用代码编写ui
- 采用代码编写UI界面
- 使用代码编写android UI
- 采用html编辑界面ui&java_javascript代码的互相调用
- Android 常用代码---UI
- Android -- 样式和主题,用代码方式编写UI,用WebView通过html开发界面
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- iOS 实时显示编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- 实时显示iOS编写UI代码效果
- “错误:java找不到或无法加载主类(主方法)***”解决方法
- 数据库
- The import android.support cannot be resolved的解决方案
- 联想Y470 非虚拟机安装苹果Mac OS X Mavericks 10.9.1教程详解(文字+图片),通俗易懂亲自动手——序列四之重启系统,系统设置
- c++面试题5
- Android 采用代码编写ui
- linux 重定向
- CATransition
- Json的笔记和摘抄
- 数据库系统概述
- Web Service(二):+ Web三层架构 (One Demo,More Questions)
- 【CodingTrip - 携程编程大赛第一场】1001 聪明的猴子
- 1004
- 某人穿越到先秦..