2015-12-02 34 views
3

編輯:不幸的是,我仍然沒有取得這個問題的進展。我想這是由於我是Android初學者而產生的男子氣概。任何意見或建議都受到高度讚賞(這是我在工作中遇到的問題)。我應該提供更多信息還是我的問題缺乏重要性?Horizo​​ntalScrollView中的SortableTableView不斷增長

我正在使用此庫對我的應用程序有一個可排序的表格視圖:https://github.com/ISchwarz23/SortableTableView。由於應用程序應該在智能手機上鎖定爲肖像模式,因此我將視圖放入了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> 

請告訴我,如果你需要更多的信息。任何幫助非常感謝! :)

回答

3

不幸的是,我不能重現鎖定肖像模式,但作爲您的問題描述非常詳細,我能夠很容易地重現調整大小問題。
我很高興地告訴你,我已經能夠解決你給出的例子的問題。請更新您的依賴到最新版本(0.9.6),並告訴我,如果這真的解決了你的問題。

+0

非常感謝,更新修復了這個問題:)。 – Lupa