下面是别人源码里的layout\main.xml文件:1)five.itcast.cn.Chessboard是一个自定义的类,public class Chessboard extends View implements IChessboard{。
它继承于View的。竟可以与TextView一样,加入到layout中?2)<RelativeLayout也是一种布局方式,它是可以内嵌于<FrameLayout吗?<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"> <five.itcast.cn.Chessboard android:id="@+id/snake"
android:layout_width="match_parent"
android:layout_height="match_parent"
tileSize="24"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:text="@string/mode_ready"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#ff0000"
android:textSize="24sp"
/>
</RelativeLayout></FrameLayout>
它继承于View的。竟可以与TextView一样,加入到layout中?2)<RelativeLayout也是一种布局方式,它是可以内嵌于<FrameLayout吗?<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"> <five.itcast.cn.Chessboard android:id="@+id/snake"
android:layout_width="match_parent"
android:layout_height="match_parent"
tileSize="24"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:text="@string/mode_ready"
android:visibility="visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:textColor="#ff0000"
android:textSize="24sp"
/>
</RelativeLayout></FrameLayout>
解决方案 »
- android获取webservice返回值解析问题
- [Android:Kernel]怎么在Kernel里添加宏
- android2.3.4(linux2.6.36)下, menuconfig 如何调出来?
- 这里不能发招聘贴吗?为什么删我的贴?
- 新手咨询如何通过eclipse搭建android平台
- listview单击和长按的操作!
- 问个安卓反编译的问题
- Android—EditText重新获取焦点后无法编辑
- 新手求助:如何搭建android+tomcat+Mssql
- 安卓屏幕分成两部分,其中一部分是相机,测试发现想拍摄的事物变形了,怎么办?
- 关于animation结束时,View OnClick触发位置的问题
- 3G中间件 = 移动中间乎?
2.可以。FrameLayout,RelativeLayout 同属viewgroup,view有属于view,所以可以
把GameView当成控件加入到Layout中
===
个人博客:www.girlcoding.com
2.可以。FrameLayout,RelativeLayout 同属viewgroup,view有属于view,所以可以