<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="3dip"
tools:context=".MainActivity" > <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="今日概况:" />
/>
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:padding="3dip"
>
<TableRow>
<ImageButton
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src ="@drawable/st0"
/>
<ImageButton
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src ="@drawable/st1"
/>
</TableRow>
<TableRow>
<ImageButton
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src ="@drawable/st0"
/>
<ImageButton
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src ="@drawable/st1"
/>
</TableRow>
</TableLayout></LinearLayout>上面是我的布局代码
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="今日概况:" />
/>
如果这样写,后面4个ImageButton不会显示<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="今日概况:" />
/>
如果是这样,后面4个ImageButton 可以显示,但跟TextView 是在同一行,怎样可以把4个ImageButton 放到下一行 并且能整体居中 谢谢!
解决方案 »
- 我想把一个应用的代码文件打包成jar在集成另一个应用里面怎么做?
- Flex & Android将是趋势
- 如何更改虚拟版本?
- 跪求Android中文教程
- EditText里面如何使用ScrollView
- 我应该怎么选择?或者继续吗?
- [转]对Android开发者有益的40条优化建议
- android上调用系统的硬解码
- 真机通过url访问Mysql+tomcat建立的服务器一直超时
- Androidstudio刚下载完打开第一个项目代码形式不对
- 一张图片在相册中可以打开,但在ImageView却不可以显示
- android 设置开机后先于Launcher 运行,并且只运行 一次,以后开机再也不运行除非恢复出厂设置。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="3dip"
tools:context=".MainActivity" > <LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="今日概况:" />
</LinearLayout> <LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<ImageButton
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/st0" />
<ImageButton
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/st1" />
<ImageButton
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/st0" />
<ImageButton
android:id="@+id/button4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:src="@drawable/st1" />
</LinearLayout></LinearLayout>