Chinaunix首页 | 论坛 | 博客
  • 博客访问: 447791
  • 博文数量: 145
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 1060
  • 用 户 组: 普通用户
  • 注册时间: 2013-08-22 11:52
个人简介

专注计算机技术: Linux Android 云计算 虚拟化 网络

文章分类

全部博文(145)

文章存档

2016年(3)

2015年(21)

2014年(75)

2013年(46)

我的朋友

分类: Android平台

2013-11-06 16:41:31


点击(此处)折叠或打开

  1. private class SpeechView extends LinearLayout {
  2.             private TextView mTitle;
  3.             private TextView mDialogue;
  4.     public SpeechView(Context context, String title, String words) {
  5.                 super(context);
  6.                 this.setOrientation(VERTICAL);
  7.                 // Here we build the child views in code. They could also have
  8.                 // been specified in an XML file.
  9.                 mTitle = new TextView(context);
  10.                 mTitle.setText(title);
  11.                 addView(mTitle, new LinearLayout.LayoutParams(
  12.                         LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  13.                 mDialogue = new TextView(context);
  14.                 mDialogue.setText(words);
  15.                 addView(mDialogue, new LinearLayout.LayoutParams(
  16.                         LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
  17.             }
  18.             /**
  19.              * Convenience method to set the title of a SpeechView
  20.              */
  21.             public void setTitle(String title) {
  22.                 mTitle.setText(title);
  23.             }
  24.             /**
  25.              * Convenience method to set the dialogue of a SpeechView
  26.              */
  27.             public void setDialogue(String words) {
  28.                 mDialogue.setText(words);
  29.             }
  30.               
  31.         }


阅读(652) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~