android - Android UI 中类似 Excel 的行为

标签 android user-interface scroll

我正在尝试创建一个 Android View ,但我很吃力。所以希望有人能帮忙:

基本上它是一个表格,但最左边的列不应该是可滚动的,其余的应该是可滚动的。就像Excel一样。最左边的列(所有递增的数字)永远不会消失,即使您滚动到第 XX 列也是如此。

关于如何实现这个的任何线索?原因是最左边的列将是键列表,其余列将是值。

最佳答案

A scetch of what I was trying to do

我利用我在 Ms Paint 中的 leet 技能画了这个东西。所以这个想法是,当你上下滑动时……一切都会滚动……但是当你从左向右滑动时,只有右边的表格会移动。左侧将是静态的。

我也会在这里添加源:

<LinearLayout
android:id="@+id/widget60"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:scrollbars="vertical"
>
<TableLayout
android:id="@+id/schedule_stops"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
>
</TableLayout>
<HorizontalScrollView
android:id="@+id/widget69"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@id/schedule_stops"
>
<TableLayout
android:id="@+id/schedule_times"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"
>
</TableLayout>
</HorizontalScrollView>
</LinearLayout>

关键是使用 Horizo​​ntalScrollView 而不是普通的 ScrollView

关于android - Android UI 中类似 Excel 的行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8229452/

相关文章:

c++ - Qt - 不完整类型的无效使用 'class QScrollBar' - 向文本编辑小部件添加水平滚动条

android - webview 和 scrollview 的问题

android - DrawerLayout 必须使用 MeasureSpec.EXACTLY 进行测量

c++ - 只需在 Qt 中更新标签

android - 将纯文本发送到 Android 中的 USB 打印机

user-interface - PyQt 和 QThreads : separate threads still freezing main GUI thread?

android - 转发触摸事件并在 android 中保持动力

javascript - 如何在单击jQuery时向下滚动一定距离

android - 使用双 SIM 卡设备中的指定 SIM 卡调用电话

android - 如何更改 PhoneGap 的屏幕大小?