<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                > 編寫:[allenlsy](https://github.com/allenlsy) - 原文:[http://developer.android.com/training/improving-layouts/loading-ondemand.html](http://developer.android.com/training/improving-layouts/loading-ondemand.html) 有時你的 Layout 會用到不怎么重用的復雜視圖。不管它是列表項 細節,進度顯示器,或是撤銷時的提示信息,你可以僅在需要的時候載入它們,提高 UI 渲染速度。 ### 定義 ViewStub [ViewStub](http://developer.android.com/reference/android/view/ViewStub.html) 是一個輕量的視圖,不需要大小信息,也不會在被加入的 Layout 中繪制任何東西。每個 ViewStub 只需要設置 `android:layout` 屬性來指定需要被 inflate 的 Layout 類型。 以下 ViewStub 是一個半透明的進度條覆蓋層。功能上講,它應該只在新的數據項被導入到應用程序時可見。 ~~~ <ViewStub android:id="@+id/stub_import" android:inflatedId="@+id/panel_import" android:layout="@layout/progress_overlay" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="bottom" /> ~~~ ### 載入 ViewStub Layout 當你要載入用 ViewStub 聲明的 Layout 時,要么用 `setVisibility(View.VISIBLE)` 設置它的可見性,要么調用其 `inflate()` 方法。 ~~~ ((ViewStub) findViewById(R.id.stub_import)).setVisibility(View.VISIBLE); // or View importPanel = ((ViewStub) findViewById(R.id.stub_import)).inflate(); ~~~ > 注意:`inflate()` 方法會在渲染完成后返回被 inflate 的視圖,所以如果你需要和這個 Layout 交互的話, 你不需要再調用 `findViewById()` 去查找這個元素,。 一旦 ViewStub 可見或是被 inflate 了,ViewStub 元素就不存在了。取而代之的是被 inflate 的 Layout,其 id 是 ViewStub 上的 `android:inflatedId` 屬性。(ViewStub 的 `android:id` 屬性僅在 ViewStub 可見以前可用) > 注意:ViewStub 的一個缺陷是,它目前不支持使用 `<merge/>` 標簽的 Layout 。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看