TableLayout比较常用,设计简洁.
xxxxxActivity.java:
package com.fp.xxx
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
public class xxxxxActivity extends Activity implements View.OnClickListener
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.wirelesscity_main);
findViewById(R.id.xxxxx).setOnClickListener(this);
}
public void onClick(View v) {
switch(v.getId()) {
case R.id.wcm_jglz:
....
break;
}
}
layout/xxxxx.xml:
<?xml version="1.0" encoding="utf-8"?>
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wc_main"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1"
android:background="#FFF">
<TableRow>
<Button android:id="@+id/wcm_jglz"
android:background="@drawable/xxxxxxxx"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
style="@style/xxxxxxx"
android:text="xxxxxxx"/>
</TableRow>
<TableRow>
......
</TableRow>
<TableRow>
......
</TableRow>
<TableRow>
......
</TableRow>
</TableLayout>
本文介绍了一个使用TableLayout实现的简洁界面设计案例。该案例详细展示了如何在Android应用中通过Java代码和XML布局文件来创建一个包含多个按钮的表格布局。通过对xxxxxActivity.java和对应的layout/xxxxx.xml文件的解析,读者可以了解TableLayout的基本用法及其在实际项目中的应用。
1038

被折叠的 条评论
为什么被折叠?



