addView android

Android 中LinearLayout中addView妙用並添加子項的監聽器

   以前我只知道ListView中可以動態的加載一些項,慢方便的,格式又固定,又可以隨意的顯示很多項,但是我在添加的項太多了的時候,我發先不行了,特別是添加圖片多的時候,就會卡死了,這樣我感到很尷尬,好用的東西怎麼這麼經不起考研呢,百思不得其解,後來有人說LinearLayout有東東可以研究,我去研究了下,發現了一個addView,讓我看到了希望。感動之餘還是分享一下吧!!
廢話少說,還是從佈局開始吧:這個佈局可以忽略了
<LinearLayout
            android:orientation="vertical"
            android:id="@+id/lin_addaddress"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
       >
       <LinearLayout
           android:orientation="horizontal"
           android:layout_width="fill_parent"
           android:layout_height="wrap_content"
           >
           <TextView
               android:text="@string/address"
               android:layout_width="269dp"
               android:layout_height="wrap_content"
               />
           <Button
               android:id="@+id/address"
               android:text="@string/add"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
  
發佈了7 篇原創文章 · 獲贊 4 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章