`

布局专题二:帧布局

 
阅读更多
package com.gouchao;

import android.app.Activity;
import android.os.Bundle;

/**
 * 帧布局
 * @author Administrator
 *
 */
public class Layout2 extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.main);
	}

	
	
}

 

<?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"
    >
	<FrameLayout
		android:layout_width="wrap_content"
		android:layout_height="wrap_content"
	>
		<!-- 红色 -->
		<TextView
			android:layout_width="100px"
			android:layout_height="100px"
			android:background="#aa0000"
		></TextView>
		<!-- 绿色 -->
		<TextView
			android:layout_width="80px"
			android:layout_height="80px"
			android:background="#00aa00"
		></TextView>
		<!-- 蓝色 -->
		<TextView
			android:layout_width="40px"
			android:layout_height="40px"
			android:background="#0000aa"
		></TextView>
		
	</FrameLayout>
</LinearLayout>

 效果:

 

  • 大小: 12.5 KB
0
2
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics