在我自己的手机上(G12,系统版本2.3.3)。以下布局,无法在手机上看到THR:

        
  1. <LinearLayout
  2. android:orientation="horizontal"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent"
  5. android:layout_weight="1"
  6. android:background="#AABBCC">
  7. <TextViewandroid:text="ONE"
  8. android:background="#aa0000"
  9. android:layout_height="fill_parent"
  10. android:layout_width="fill_parent"
  11. android:gravity="center"
  12. android:layout_weight="1"/>
  13. <TextViewandroid:text="TWO"
  14. android:layout_width="fill_parent"
  15. android:layout_height="fill_parent"
  16. android:background="#00aa00"
  17. android:gravity="center"
  18. android:layout_weight="2"/>
  19. <TextViewandroid:text="THR"
  20. android:layout_width="fill_parent"
  21. android:layout_height="fill_parent"
  22. android:layout_weight="3"
  23. android:background="#0000aa"
  24. android:gravity="center"/>
  25. </LinearLayout>

讲解layout_weight配合LinearLayout使用的文章:

layout_weight体验(实现按比例显示):

http://www.cnblogs.com/zhmore/archive/2011/11/04/2236514.html

还有一篇,android布局参数详解:

http://blog.csdn.net/trampou/article/details/5752533

综合实例:

LinearLayout嵌套ScrollView,ScrollView中再嵌套LinearLayout,LinearLayout中再嵌套很多按钮等控件:

        
  1. <LinearLayout
  2. android:orientation="vertical"
  3. android:layout_width="fill_parent"
  4. android:layout_height="fill_parent">
  5. <ScrollView
  6. android:layout_width="fill_parent"
  7. android:layout_height="0dp"
  8. android:scrollbars="vertical"
  9. android:fadeScrollbars="false"
  10. android:layout_weight="2">
  11. <LinearLayoutandroid:orientation="vertical"
  12. android:layout_width="fill_parent"
  13. android:layout_height="wrap_content"
  14. >
  15. <Button
  16. android:id="@+id/StartMusic"
  17. android:layout_width="wrap_content"
  18. android:layout_height="wrap_content"
  19. android:text="开始"/>
  20. <Button
  21. android:id="@+id/FrontButton"
  22. android:layout_width="wrap_content"
  23. android:layout_height="wrap_content"
  24. android:text="前一首"/>
  25. <Button
  26. android:id="@+id/LastMusic"
  27. android:layout_width="wrap_content"
  28. android:layout_height="wrap_content"
  29. android:text="最后一首"/>
  30. <SeekBar
  31. android:id="@+id/audioVolume"
  32. android:layout_width="fill_parent"
  33. android:layout_height="wrap_content"
  34. />
  35. <SeekBar
  36. android:id="@+id/seekbar01"
  37. android:layout_width="fill_parent"
  38. android:layout_height="wrap_content"
  39. />
  40. </LinearLayout>
  41. </ScrollView>
  42. ...(其他布局或ScrollView)
  43. </LinearLayout>

更多相关文章

  1. android BaseAdapter优化
  2. Android(安卓)内存泄漏 - 不要用static修饰控件
  3. Android常用控件-DatePicker以及对话框的两种使用方法
  4. 在Android线程中设置控件的值会报错
  5. Android(安卓)RecycerView 中根据图片大小自适应控件大小的实现
  6. Android中View绘制优化二一---- 使用标签复用布局文件
  7. Android(安卓)实现仿支付宝的密码均分输入框
  8. 用RelativeLayout布局可以在imageview中写上文字
  9. Android(安卓)ViewPager 几种开发案例的使用

随机推荐

  1. 【Mac版】安装 Android Studio 及配置环
  2. android集合处理:List中的map以及LinkedHa
  3. [置顶] Android Studio之初体验 ---- 很
  4. smdk6410 android driver powerbutton
  5. Android Application分析
  6. android中permission_group与permisson区
  7. Android(安卓)GPS学习
  8. Android SDK自定义更新
  9. Android中完全退出程序的四种方法
  10. Android用户界面开发(21):状态栏提示