Edit: Unfortunately, I still have not made progress with this problem. I guess this is manly due to me being an Android beginner. Any input or suggestion is highly appreciated (this is a problem that I have at work). Should I give additional information or does my question lack anything important?
I am using this library to have a sortable table view for my app: https://github.com/ISchwarz23/SortableTableView. Because the app is supposed to be locked to portrait mode on smartphones, I put the view into a HorizontalScrollView so that the user can scroll to see different columns the columns. My problem is that each time I tab on a column-header to sort the table, the table grows a bit wider. Do you have an idea what is causing this or how I could prevent it from happening?
If you want to see it yourself, it's enough to import the sample application of the library that is included when you clone the repository and slightly modify it. Just put the tableview into a HorizontalScrollView and you can already see this behavior.
The main_activity.xml looks as follows:
<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>
Please tell me if you need additional information. Any help is very appreciated! :)
Unfortunately I cannot reproduce the locking to portrait mode but as your issue description was very detailed, I was able to reproduce the resizing issue very easy.
I'm happy to tell you that I was able to fix the issue for the example you have given. Please update your dependency to the latest version (0.9.6) and tell me, if this has really fixed the issue for you.