最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android ScrollView只能添加一個(gè)子控件問(wèn)題解決方法

 更新時(shí)間:2016年02月24日 11:23:46   作者:炫_(tái)愛(ài)羊  
這篇文章主要介紹了Android ScrollView只能添加一個(gè)子控件問(wèn)題解決方法,涉及Android界面布局的相關(guān)技巧,需要的朋友可以參考下

本文實(shí)例講述了Android ScrollView只能添加一個(gè)子控件問(wèn)題解決方法。分享給大家供大家參考,具體如下:

有下面一段代碼

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >
  <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" />
    <Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" />
    <Button
      android:layout_width="fill_parent"
      android:layout_height="wrap_content" />
  </ScrollView>
</LinearLayout>

一個(gè)ScrollView里面添加了三個(gè)Button,也許你認(rèn)為沒(méi)有什么問(wèn)題,那么我們運(yùn)行一下看看

出現(xiàn)了一個(gè)異常

很明顯,異常告訴我們ScrollView can host only one direct child

既然說(shuō)只能容納一個(gè)直接的子控件,那么我們就可以容納多個(gè)間接的子控件,直接在這些子控件外面再套一層LinearLayout就OK了

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical" >
  <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" >
      <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
      <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
      <Button
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" />
    </LinearLayout>
  </ScrollView>
</LinearLayout>

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android開(kāi)發(fā)入門與進(jìn)階教程》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論

滁州市| 清丰县| 周宁县| 克什克腾旗| 界首市| 广灵县| 宣威市| 白银市| 泽普县| 长宁区| 个旧市| 定结县| 西华县| 宁海县| 武清区| 安岳县| 凤台县| 延边| 晋宁县| 邵阳市| 望都县| 得荣县| 张掖市| 余庆县| 商都县| 博乐市| 辽阳市| 清新县| 和平县| 海丰县| 郁南县| 诏安县| 舞阳县| 弥渡县| 盐池县| 崇信县| 博客| 个旧市| 承德市| 吴川市| 莱阳市|