首页 > 移动平台 > 详细

android灵活布局

时间:2014-03-22 01:28:45      阅读:437      评论:0      收藏:0      [点我收藏+]

一开始接触android,只知道拖拉布局,不灵活,难看很。后来才发现,原来和jsp一样,可以灵活使用xml文件。

话不多说,直接上例子

任何布局既可以在代码中实现,也可以在xml中实现。下面是用xml实现的一个例子

 

src文件中

bubuko.com,布布扣

layout目录下,新建test_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >
    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:stretchColumns="1"
        >
        <TableRow >
            <TextView
                android:text="ceshi"
                android:id="@+id/layoutTextView01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:textColor="#ffff"
                >
               
            </TextView>
            <EditText
                android:text=""
                android:id="@+id/EditText01"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
               
                />
           
        </TableRow>
        <TableRow android:gravity="right">
            <Button
                android:text="test"
                android:id="@+id/layoutButton1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                />
           
        </TableRow>
       
    </TableLayout>

</LinearLayout>


 

 

android灵活布局,布布扣,bubuko.com

android灵活布局

原文:http://blog.csdn.net/tuntunwang/article/details/21743233

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!