android - Horizo​​ntalScrollView 中的 SortableTableView 不断增长

标签 android horizontalscrollview

编辑:不幸的是,我仍然没有在这个问题上取得进展。我想这很有男子气概,因为我是 Android 初学者。非常感谢任何输入或建议(这是我在工作中遇到的问题)。我应该提供更多信息还是我的问题缺少任何重要信息?

我正在使用这个库为我的应用程序提供可排序的表格 View :https://github.com/ISchwarz23/SortableTableView .因为该应用程序应该在智能手机上锁定为纵向模式,所以我将 View 放入 Horizo​​ntalScrollView 以便用户可以滚动以查看不同的列。 我的问题是,每次我在列标题上切换以对表格进行排序时,表格都会变宽一点。您知道是什么原因造成的,或者我该如何防止它发生?

如果你想自己看看,导入你克隆存储库时包含的库的示例应用程序并稍微修改它就足够了。只需将 tableview 放入 Horizo​​ntalScrollView 中,您就可以看到这种行为。

main_activity.xml 如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:tools="http://schemas.android.com/tools"
                xmlns:custom="http://schemas.android.com/apk/res-auto"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                tools:context="de.codecrafters.tableviewexample.MainActivity">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/primary"
        custom:title="@string/title_activity_main"
        custom:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" />

    <android.widget.HorizontalScrollView
        android:id="@+id/scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <de.codecrafters.tableviewexample.SortableCarTableView
            android:id="@+id/tableView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@id/toolbar"
            custom:columnCount="4"
            custom:headerElevation="10"
            custom:headerColor="@color/primary" />

    </android.widget.HorizontalScrollView>

</RelativeLayout>

如果您需要更多信息,请告诉我。非常感谢任何帮助! :)

最佳答案

不幸的是,我无法重现锁定到纵向模式,但由于您的问题描述非常详细,我能够非常轻松地重现调整大小的问题。
我很高兴地告诉您,我能够解决您提供的示例的问题。请将您的依赖项更新到最新版本 (0.9.6) 并告诉我,这是否真的为您解决了问题。

关于android - Horizo​​ntalScrollView 中的 SortableTableView 不断增长,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34046742/

相关文章:

android - 如何保留之前加载的图像?

java - TableLayout 外的边距

android - Horizo​​ntalScrollView 自定义适配器?

android - 如何制作重复(圆形)水平 ScrollView ?

android - 如何处理属于 Horizo​​ntalScrollView 的 RelativeLayout 上的 onClick

android - PopupWindow 中的 Horizo​​ntalScrollView

android - 动态创建的按钮宽度没有改变

android - 在android中为imageview平滑淡出

Android_id 来引导?

android - 动态水平 View