private class SpeechView extends LinearLayout { private TextView mTitle; private TextView mDialogue; public SpeechView(Context context, String title, String words) { super(context); this.setOrientation(VERTICAL); // Here we build the child views in code. They could also have // been specified in an XML file. mTitle = new TextView(context); mTitle.setText(title); addView(mTitle, new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); mDialogue = new TextView(context); mDialogue.setText(words); addView(mDialogue, new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); } /** * Convenience method to set the title of a SpeechView */ public void setTitle(String title) { mTitle.setText(title); } /** * Convenience method to set the dialogue of a SpeechView */ public void setDialogue(String words) { mDialogue.setText(words); } }

参考:APIDEMO--->view---> List4.java

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. Android(安卓)学习笔记 Thread (一) androi
  2. android菜鸟学习笔记12----Android控件(
  3. Android的第二个应用---电话拨号器
  4. android颜色对应的xml配置值,颜色表
  5. android弹出框2(相当于通知)
  6. android线性布局LinerLayout
  7. Android开发秘籍学习笔记(五)
  8. android animation中的参数interpolator
  9. Visual Studio 2010 也能开发Android(安
  10. Android(安卓)Camera 找来找去还是觉得ap