Git Product home page Git Product logo

Comments (17)

thagikura avatar thagikura commented on September 21, 2024

Could you share the layout xml you are using (or code snippet if you set it from code)?

from flexbox-layout.

thagikura avatar thagikura commented on September 21, 2024

Please re-open it with your layout XML and the code snippet.
Thanks.

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

I have two childView in FlexboxLayout ,if i set one View gone ,FlexboxLayout invisible

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

<com.google.android.flexbox.FlexboxLayout
android:id="@+id/lay_marks"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/tv_movie_score"
app:flexDirection="row"
app:justifyContent="flex_start"
>

        <TextView
            android:id="@+id/tv_movie_name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginRight="@dimen/dp4"
            android:singleLine="true"
            android:text="电影名称哈哈哈"
            android:textColor="@color/black"
            android:textSize="@dimen/tsize_title"
            app:layout_flexShrink="1"/>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:gravity="center"
            app:layout_flexShrink="0">

            <com.kokozu.widget.flat.FlatTextView
                android:id="@+id/tv_mark_new"
                style="@style/Widget.Flat.Mark.MovieNew"
                android:layout_marginRight="@dimen/dp4"
                android:singleLine="true"
                />

            <com.kokozu.widget.flat.FlatTextView
                android:id="@+id/tv_mark_3d"
                style="@style/Widget.Flat.Mark.3DIMAX"
                android:singleLine="true"
                />
        </LinearLayout>


    </com.google.android.flexbox.FlexboxLayout>

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

if (isNew) {
holder.tvMarkNew.setVisibility(View.VISIBLE);
} else {
holder.tvMarkNew.setVisibility(View.GONE);
}
if (is3D || isIMAX) {
StringBuilder imax3D = new StringBuilder();
holder.tvMark3d.setVisibility(View.VISIBLE);
if (isIMAX) {
imax3D.append("IMAX");
} else {
imax3D.append("3D");
}
holder.tvMark3d.setText(imax3D.toString());
} else {
holder.tvMark3d.setVisibility(View.GONE);
}

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

i must use LinearLayout package TextView

from flexbox-layout.

thagikura avatar thagikura commented on September 21, 2024

The top of your pasted layout xml is truncated. Could you paste the full layout xml?
I tried locally with the children views whose visibilities are gone and it worked fine.

Also please confirm the following.

  • Please try showing your layout not within part of the ListView
  • Before setting the visibility from the code, is the layout in question visible?

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

public class MyAdapter extends BaseAdapter {

private Context mContext;

public MyAdapter(Context context) {
    mContext = context;
}

@Override
public int getCount() {
    return 100;
}

@Override
public Object getItem(int position) {
    return position;
}

@Override
public long getItemId(int position) {
    return position;
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {
    Holder holder;
    if (convertView == null) {
        convertView = LayoutInflater.from(mContext).inflate(R.layout.item, null);
        holder = new Holder();
        holder.tv = (TextView) convertView.findViewById(R.id.tv);
        convertView.setTag(holder);
    } else {
        holder = (Holder) convertView.getTag();
    }
    if (position / 2 == 0) {
        holder.tv.setVisibility(View.VISIBLE);
    } else {
        holder.tv.setVisibility(View.GONE);
    }
    return convertView;
}

private static class Holder {
    private TextView tv;
}

}

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

itemxml.txt

from flexbox-layout.

thagikura avatar thagikura commented on September 21, 2024

Thanks. How was the following?

Please try showing your layout not within part of the ListView
Before setting the visibility from the code, is the layout in question visible?

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

public class MainActivity extends AppCompatActivity {

private ListView lv;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    lv = (ListView) findViewById(R.id.lv);
    lv.setAdapter(new MyAdapter(this));
}

}

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

Uploading acitivity.txt…

from flexbox-layout.

thagikura avatar thagikura commented on September 21, 2024

Could you try the following in your environment and see if you still see the invisible FlexboxLayout?
I didn't ask you to upload the code for your Activity.

Please try showing your layout not within part of the ListView
Before setting the visibility from the code, is the layout in question visible?

from flexbox-layout.

a251115100 avatar a251115100 commented on September 21, 2024

app.zip

from flexbox-layout.

diantahoc avatar diantahoc commented on September 21, 2024

This bug also occurs if I put 5 TextView controls inside the Flexbox layout and set the visibility to gone for 2 TextViews. If I set 1 TextView to gone, the flexbox remains visible.

What I have noticed is that if the TextViews don't fit in the screen width, the Flexbox is visible.

The workaround was to put all the individual text views inside a linearlayout as @a251115100 have mentioned.

The bug can be reproduced with the following code:

 <com.google.android.flexbox.FlexboxLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:flexDirection="row"
                app:flexWrap="wrap"
                app:justifyContent="center">


                    <TextView
                        android:id="@+id/text_view_correct_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:drawableLeft="@drawable/correct_pie_chart_icon"
                        android:drawablePadding="5dp"
                        android:text="@string/label_correct"
                        android:textColor="@color/color_text"
                        android:textSize="@dimen/generic_text_size" />

                    <TextView
                        android:id="@+id/text_view_skipped_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:drawableLeft="@drawable/skipped_pie_chart_icon"
                        android:drawablePadding="5dp"
                        android:text="@string/label_skipped"
                        android:textColor="@color/color_text"
                        android:textSize="@dimen/generic_text_size" />

                    <TextView
                        android:id="@+id/text_view_assisted_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_margin="5dp"
                        android:drawableLeft="@drawable/assisted_pie_chart_icon"
                        android:drawablePadding="5dp"
                        android:text="@string/label_assisted"
                        android:textColor="@color/color_text"
                        android:textSize="@dimen/generic_text_size" />

                    <TextView
                        android:id="@+id/text_view_incorrect_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:drawableLeft="@drawable/incorrect_pic_chart_icon"
                        android:drawablePadding="5dp"
                        android:text="@string/label_incorrect"
                        android:textColor="@color/color_text"
                        android:textSize="@dimen/generic_text_size" />

                    <TextView
                        android:id="@+id/text_view_reported_label"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_margin="5dp"
                        android:drawableLeft="@drawable/reported_pie_chart_icon"
                        android:drawablePadding="5dp"
                        android:text="@string/label_reported"
                        android:textColor="@color/color_text"
                        android:textSize="@dimen/generic_text_size" />

            </com.google.android.flexbox.FlexboxLayout>

from flexbox-layout.

thagikura avatar thagikura commented on September 21, 2024

Thanks for the clarification. I'll take a look.

from flexbox-layout.

thagikura avatar thagikura commented on September 21, 2024

I think I spot the issue.
It happens when the first TextView's visibility in the second flex line is "gone".

If so it should be fixed by #52.

from flexbox-layout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.