Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Header shriking while creating several columns #20

Closed
gabrieltm opened this issue Mar 29, 2016 · 9 comments
Closed

Header shriking while creating several columns #20

gabrieltm opened this issue Mar 29, 2016 · 9 comments
Assignees

Comments

@gabrieltm
Copy link

First, i want to thank you for this amazing lib.

I have a problem while creating several columns, they are shrinking in size and the columns names stay like ("header here..."), i have tried to increase the setColumnWeight but with no success, i already added the horizontal scroll view like the other issues presented. Is there any way to increase the width of the columns ?

@gabrieltm gabrieltm changed the title Header shriking while creating several columns horizontally Header shriking while creating several columns Mar 29, 2016
@ISchwarz23
Copy link
Owner

Hi gabrieltm,
I think you are using the TableView using the size attributes match_parent. As you have the TableView inside a HorizontalScollView so you can simplify set a fixed width to the TableView and then adjust the column widths by giving specific weights.
Is this What you are trying to achive?

@ISchwarz23 ISchwarz23 self-assigned this Apr 1, 2016
@gabrieltm
Copy link
Author

Actually, when i try to set specific weights on my SortableTableView, some of the other columns shrink in size, also some data in the rows also automatically wrap their texts.

Is there a way to make all texts of the rows in a single line only and make them adjust their column width by their size ? I want this for the Headers also if the row data text size is smaller than the headers text size.

@ISchwarz23
Copy link
Owner

Yes, you can prevent the table data to be wrapped by writing your custom TableDataAdapter.

public class SingleLineTableDataAdapter extends SimpleTableDataAdapter {

    public SimpleTableDataAdapter(final Context context, final String[][] data) {
        super(context, data);
    }

    public SimpleTableDataAdapter(final Context context, final List<String[]> data) {
        super(context, data);
    }

   @Override
    public View getCellView(final int rowIndex, final int columnIndex, final ViewGroup parentView) {
        TextView textView = (TextView) super.getCellView(rowIndex, columnIndex, parentView);
        textView.setSingleLine(true);
        textView.setLines(1);
        textView.setEllipsize(null);
        ...
        return textView;
    }

}

Unfortunately the TableView is not accepting WRAP_CONTENT as width parameter. So your text will be simply cut off. But at least with the next bug fix version you will be able to set an absolute width (e.g. android:layout_width="900dp").

@gabrieltm
Copy link
Author

Hello,

So it's not possible to prevent this bug of getting my text of the headers being cut off ?

@ISchwarz23
Copy link
Owner

The bug fix version will be finished this week. Then you are able to put the TableView inside a HorizontalScollView and set a fixes width.
Does this fulfill your needs?

@gabrieltm
Copy link
Author

Sure does ! Thank you very much man

@ISchwarz23
Copy link
Owner

Have a try de.codecrafters.tableview:tableview:1.1.1 ;)
Please give me feedback if it is working correctly.

@gabrieltm
Copy link
Author

gabrieltm commented Apr 20, 2016

I'm having a problem while trying to execute the project with the new 1.1.1 library.

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v7/appcompat/R$anim.class

Do you have any idea why is this happening ? By the way i upgraded my android studio to 2.0 and gradle build to 2.0

I was using the 1.1.0 version, it works fine, but when i change the version it gives this errors...

@ISchwarz23
Copy link
Owner

Hi @gabrieltm,
can you please give feeback, if this error still occurs?
Best regards,
Ingo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants