1.xml生成的
<?xml version=”1.0” encoding=”utf-8”?>
<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”
android:orientation=”vertical”
android:layout_width=”fill_parent”
android:layout_height=”fill_parent”>
<TextView
android:layout_width=”fill_parent”
android:layout_height=”wrap_content”
android:text=”Hello World, HelloWorld”
/>
</LinearLayout>
2.代码写的hello world!
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
LinearLayout.LayoutParams lp;
lp = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT);
LinearLayout.LayoutParams textViewLP;
textViewLP = new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT);
LinearLayout ll = new LinearLayout(this);
ll.setOrientation(LinearLayout.VERTICAL);
TextView myTextView = new TextView(this);
myTextView.setText(“Hello World, HelloWorld”);
ll.addView(myTextView, textViewLP);
this.addContentView(ll, lp);
}

更多相关文章

  1. Android 代码改变图片颜色android:tint="@color/main_color" and
  2. Kotlin 写 Android 单元测试(四),Robolectric 在 JVM 上测试安卓相
  3. 修改 framework 代码的经验和踩过的坑
  4. android常用颜色代码定义
  5. android 代码proguard
  6. Android日志系统分析之日志设备驱动程序代码阅读

随机推荐

  1. android中的weight
  2. Android日记之2012/02/16——浅谈Android
  3. android开发问题解决日志
  4. [置顶] 浅谈Android的资源编译过程
  5. Android Studio 快速开始
  6. 1.3TextView
  7. 去除listView和recyclerview滑动到顶部和
  8. Android自动朗读(TTS)的实现
  9. android 下编译c++项目
  10. android 震动的api介绍