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

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

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

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

有下面一段代碼

<?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)為沒有什么問題,那么我們運(yùn)行一下看看

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

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

既然說只能容納一個(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開發(fā)入門與進(jìn)階教程》、《Android多媒體操作技巧匯總(音頻,視頻,錄音等)》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》、《Android布局layout技巧總結(jié)》及《Android控件用法總結(jié)

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

相關(guān)文章

最新評論

南陵县| 金坛市| 井研县| 无棣县| 玉田县| 井研县| 巴楚县| 阿荣旗| 珲春市| 皮山县| 邳州市| 徐水县| 交城县| 建始县| 昌邑市| 从江县| 天水市| 林甸县| 阳江市| 五指山市| 垣曲县| 伊春市| 万安县| 清镇市| 湟源县| 黄大仙区| 龙胜| 二手房| 大厂| 桃园市| 屯留县| 苗栗市| 云浮市| 南部县| 平定县| 汝阳县| 沭阳县| 中牟县| 镇雄县| 邢台市| 孝义市|