Google Android之使用XML布局
package org.andylee1988;
import android.app.Activity;
import android.os.Bundle;
public class HelloAndylee1988 extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout. main );
}
}
编辑main.xml,输入以下代码:
<? xml version = "1.0" encoding = "utf-8" ?>
< TextView xmlns:android = "http://schemas.android.com/apk/res/android"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
android:text = "@string/hello" />
编辑strings.xml,输入:
<? xml version = "1.0" encoding = "utf-8" ?>
< resources >
< string name = "hello" > Hello, andylee1988! I am a string resource! </ string >
< string name = "app_name" > Andylee1988 </ string >
</ resources >
运行后将看到:
更多相关文章
- android 拖拽图片&拖动浮动按钮到处跑
- Android实现图片缩放示例
- android 获取网络上服务器图片
- Android Studio App LinearLayout多层布局嵌套
- Android图片裁剪Demo
- Android 中实现FlowLayout 布局
- android URL获取图片显示到ImageView 控件上
- android edittext编辑框光标改变事件
- Android中GridView来显示图片