滚动布局
<p>滚动布局CScrollLayout,继承于CFlexLayout,支持CFlexLayout的所有属性和方法。</p>
<h2>相关属性和方法</h2>
<h3>设置滚动条</h3>
<ul>
<li>通过XML属性控制如下:</li>
</ul>
<pre><code class="language-xml">//设置滚动条(不设置该属性,则使用默认值"ScrollBar.png")
ScrollBar="ScrollBar.png"
//强制不显示滚动条
ScrollBar=""</code></pre>
<ul>
<li>通过C++程序代码调用方法控制如下:</li>
</ul>
<pre><code class="language-c">void SetScrollBar(const String& strImage);</code></pre>
<h2>示例</h2>
<h3>垂直滚动,带滚动条</h3>
<h4>效果图</h4>
<p><img src="http://www.skinui.cn/doc/img/5.0/6/ScrollLayout1.png" alt="定位左下角的九种方法" /></p>
<h4>布局文件</h4>
<pre><code class="language-xml"><ScrollLayout AlignParentLeft="20" AlignParentTop="20" AlignParentRight="20" AlignParentBottom="20" Background="ID_COLOR_DEFAULT1">
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT5">
<TextView Text="1" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT8">
<TextView Text="2" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT5">
<TextView Text="3" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT8">
<TextView Text="4" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT5">
<TextView Text="5" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
</ScrollLayout></code></pre>
<h3>垂直滚动,不带滚动条</h3>
<h4>效果图</h4>
<p><img src="http://www.skinui.cn/doc/img/5.0/6/ScrollLayout2.png" alt="定位左下角的九种方法" /></p>
<h4>布局文件</h4>
<pre><code class="language-xml"><ScrollLayout AlignParentLeft="20" AlignParentTop="20" AlignParentRight="20" AlignParentBottom="20" Background="ID_COLOR_DEFAULT1" ScrollBar="">
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT5">
<TextView Text="1" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT8">
<TextView Text="2" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT5">
<TextView Text="3" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT8">
<TextView Text="4" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="MatchParent" Height="100" Background="ID_COLOR_DEFAULT5">
<TextView Text="5" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
</ScrollLayout></code></pre>
<h3>水平滚动,带滚动条</h3>
<h4>效果图</h4>
<p><img src="http://www.skinui.cn/doc/img/5.0/6/ScrollLayout3.png" alt="定位左下角的九种方法" /></p>
<h4>布局文件</h4>
<pre><code class="language-xml"><ScrollLayout AlignParentLeft="20" AlignParentTop="20" AlignParentRight="20" AlignParentBottom="20" Background="ID_COLOR_DEFAULT1" Direction="Column">
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT5">
<TextView Text="1" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT8">
<TextView Text="2" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT5">
<TextView Text="3" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT8">
<TextView Text="4" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT5">
<TextView Text="5" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
</ScrollLayout></code></pre>
<h3>水平滚动,不带带滚动条</h3>
<h4>效果图</h4>
<p><img src="http://www.skinui.cn/doc/img/5.0/6/ScrollLayout4.png" alt="定位左下角的九种方法" /></p>
<h4>布局文件</h4>
<pre><code class="language-xml"><ScrollLayout AlignParentLeft="20" AlignParentTop="20" AlignParentRight="20" AlignParentBottom="20" Background="ID_COLOR_DEFAULT1" Direction="Column" ScrollBar="">
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT5">
<TextView Text="1" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT8">
<TextView Text="2" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT5">
<TextView Text="3" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT8">
<TextView Text="4" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
<RelativeLayout Width="200" Height="MatchParent" Background="ID_COLOR_DEFAULT5">
<TextView Text="5" Width="MatchParent" Height="MatchParent" HorzAlign="Center" Font="ID_FONT_H4" Color="ID_COLOR_WHITE"/>
</RelativeLayout>
</ScrollLayout></code></pre>