2

私はカスケード 3.9 を使用していますが、コンテナーのスクロールに苦労しています。これは、ビジュアルにあるコードです。

<stackLayout id="parent_container" dockLayout.halign="center"
             y="60"
             height="{contentHeight}"
             width="{contentWidth}"
             >

     <gridLayout columns="2" width="{contentWidth}" id="want_scroll">

       <text string="First Name" />
       <text string="First name goes here" font="{@csm.fc.font.h4}" />

       <text string="Last Name" />
       <text string="Last name goes here" font="{@csm.fc.font.h4}" />

       // more items, causing the height to be more than that of the parent

     </gridLayout>

「want_scroll」の高さが「parent_container」の高さである {contentHeight} よりも大きいため、「want_scroll」をスクロールできるようにしたいと考えています。pointer.scrollable を true に設定して scrollView に「want_scroll」をラップするとうまくいくと思いました。しかし、そうしても違いはありません。

  <scrollView pointer.scrollable="true">
     <gridLayout columns="2" width="{contentWidth}" id="want_scroll">

       <text string="First Name" />
       <text string="First name goes here" font="{@csm.fc.font.h4}" />

       <text string="Last Name" />
       <text string="Last name goes here" font="{@csm.fc.font.h4}" />

       // more items, causing the height to be more than that of the parent

     </gridLayout>
  </scrollView>

シンプルなコンテナにスクロールを追加するにはどうすればよいですか?

スクロールによって、コンテナをスクロール可能にしたいだけであり、私の質問は右側にスクロールバーを表示することに関するものではないことに注意してください。

4

1 に答える 1

1

ScrollView のサイズを設定して、いつスクロールするかを知る必要もあります。次に例を示します。

import bb.cascades 1.0

Page {
     content: Container {
             layout: StackLayout {  }
             ScrollView {
                   content: Container {
                                          layout: StackLayout { }
                                          Label {
                                                text: "Start"
                                          }
                          //snip...  A bunch more labels would go here...

                                         Label {
                                                text: "End"
                                         }
                                  }
                   minWidth: 500
                   minHeight: 1280
           }
      }
}
于 2012-10-19T20:22:01.043 に答える