super
super
super
super .onCreate(savedInstanceState);
/* 实例化一个 LinearLayout 布局对象 */
myLayout = new
new
new
new LinearLayout( this
this
this
this );
/* 设置 LinearLayout 的布局为垂直布局 */
myLayout .setOrientation(LinearLayout.
VERTICAL
);
/* 设置 LinearLayout 布局背景图片 */
myLayout .setBackgroundResource(R.drawable.
back
);
/* 加载主屏布局 */
setContentView( myLayout );
/* 实例化一个 LinearLayout 布局参数,用来添加 View */
layoutP = new
new
new
new LinearLayout.LayoutParams( WC , WC );
/* 构造实例化 TextView 对象 */
constructTextView();
/* 把 TextView 添加到 LinearLayout 布局中 */
addTextView();
/* 设置 TextView 文本颜色 */
setTextViewColor();
/* 设置 TextView 文本内容 */
setTextViewText();
}
/* 设置 TextView 文本内容 */
public
public
public
public void
void
void
void setTextViewText() {
black_TV .setText( " 黑色 " );
blue_TV .setText( " 蓝色 " );
cyan_TV .setText( " 青绿色 " );
dkgray_TV .setText( " 灰黑色 " );
gray_TV .setText( " 灰色 " );
green_TV .setText( " 绿色 " );
ltgray_TV .setText( " 浅灰色 " );
magenta_TV .setText( " 红紫色 " );
red_TV .setText( " 红色 " );
transparent_TV .setText( " 透明 " );
white_TV .setText( " 白色 " );
yellow_TV .setText( " 黄色 " );
}
/* 设置 TextView 文本颜色 */
public
public
public
public void
void
void
void setTextViewColor() {
black_TV .setTextColor(Color.
BLACK
);
blue_TV .setTextColor(Color.
BLUE
);
dkgray_TV .setTextColor(Color.
DKGRAY
);
gray_TV .setTextColor(Color.
GRAY
);
green_TV .setTextColor(Color.
GREEN
);
ltgray_TV .setTextColor(Color.
LTGRAY
);
magenta_TV .setTextColor(Color.
MAGENTA
);