FlowLayout icon indicating copy to clipboard operation
FlowLayout copied to clipboard

Right side getting cut off

Open dwalintukan opened this issue 9 years ago • 2 comments

I am using the FlowLayout in a ScrollView and the right side of the layout is getting cut off. Not sure if this is related it to being in a ScrollView or not.

The last entry is getting cut off too.

I am programmatically adding TextViews to the FlowLayout:

private void updateMoviesTvTags() {
    moviesTvContainer.removeAllViews();

    for (int i = 0; i < 50; i++) {
        CustomTextView tag = new CustomTextView(getActivity());

        FlowLayout.LayoutParams lp = new FlowLayout.LayoutParams(FlowLayout.LayoutParams
                .WRAP_CONTENT, FlowLayout.LayoutParams.WRAP_CONTENT);
        lp.setMargins(0, 0, 10, 10);
        tag.setLayoutParams(lp);

        tag.setBackground(getResources().getDrawable(R.drawable.tag_bg));
        tag.setText("test");
        tag.setTextSize(16);
        tag.setTextColor(getResources().getColor(R.color.primary_blue));
        tag.setPadding(10, 10, 10, 10);
        moviesTvContainer.addView(tag);
    }
}

<com.wefika.flowlayout.FlowLayout
                android:id="@+id/movies_tv_container"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:gravity="start|top"
                android:padding="10dp"/>

screenshot_2015-05-28-21-12-34

dwalintukan avatar May 29 '15 04:05 dwalintukan

Try adding margin for all sides : Change your line from lp.setMargins(0, 0, 10, 10); to lp.setMargins(10, 10, 10, 10);

prakashgowinji avatar Jul 01 '15 06:07 prakashgowinji

Could it be that you set padding in your XML-Layout? I got the same problem if I add padding to the FlowLayout. Without the padding everything is working correctly.

LittleHuba avatar Sep 10 '15 21:09 LittleHuba