【问题标题】:Horizontal Scrolling Fragment with Custom View具有自定义视图的水平滚动片段
【发布时间】:2016-01-29 20:49:33
【问题描述】:
我有一个小问题,或者我不知道怎么解决。我梳理了互联网的每一个角落(指南、教程等...)
在实践中,我扩展了一个 VIEW 类,并使用画布等自定义了该类......
这个视图包含在一个还有按钮的布局中,这个布局被设置为一个片段并显示在一个活动中(像往常一样)。
我需要在自定义视图中水平“滚动”以显示所有图形,甚至隐藏,因为屏幕很小。你知道告诉我一些解决方案或指南吗?
我希望我自己解释了。
让我知道并提前感谢
问候
【问题讨论】:
标签:
android
android-fragments
layout
scrollbar
horizontal-scrolling
【解决方案1】:
将 HorizontalSCrollView 与 LinearLayout 一起使用并添加您的元素。
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="50dp" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<!-- your elements-->
</LinearLayout>
</HorizontalScrollView>