ericktijerou / koleton

The easiest library to show skeleton screens in an Android app.
Apache License 2.0
304 stars 26 forks source link

TextView doesn't set up data, skeleton screen can't show~ #27

Closed 15189611 closed 3 years ago

15189611 commented 3 years ago

I have a situation where my view doesn't set up data in advance, I need to request data set up after the network, and the skeleton screen doesn't appear at this time

ericktijerou commented 3 years ago

@15189611 thanks, I appreciate your feedback.

If you use textView.loadSkeleton() function, please make sure that you are setting android:text="@string/your_label" in your xml. I'm working in a better solution for that.

Please let me know if the still issue persists.

15189611 commented 3 years ago

if i use textView doesn't setting android:text="@string/your_label" ,the skeleton doesn't working

15189611 commented 3 years ago

because android:text="" from Remote data!

15189611 commented 3 years ago

The skeleton framework can be support?

ericktijerou commented 3 years ago

Hi @15189611 👋,

I found some issues related with TextView's skeletons and added a new extension function for textviews. It is not necessary to set text in your xml. You just have to set length for skeleton to work well.

textView?.loadSkeleton(length = 20)

Please try out 0.8.5 version.

15189611 commented 3 years ago

if is other view or viewGroup doesn't setting data maybe couldn't support ?

ericktijerou commented 3 years ago

@15189611 There is no support for LinearLayouts and RelativeLayout. I'm working on that.

The others Views and ViewGroups should work well.

15189611 commented 3 years ago

![Uploading image.png…]() i can't setting android:layout_height="120dp" , the ImageView doesn't working~

15189611 commented 3 years ago

WechatIMG94

15189611 commented 3 years ago

I need to use your framework now because all my elemental data comes from the remote

ericktijerou commented 3 years ago

@15189611 I've tried to reproduce your problem but everything works fine.

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/ivMap"
            android:layout_width="0dp"
            android:layout_height="120dp"
            android:scaleType="centerCrop"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:shapeAppearanceOverlay="@style/ShapeAppearance.RoundedCornerImageView"
            tools:srcCompat="@drawable/map_one" />

Can you please provide more information about your problem?

15189611 commented 3 years ago

i mean you don't setting android:layout_height="120dp"

15189611 commented 3 years ago

like this <com.google.android.material.imageview.ShapeableImageView android:id="@+id/ivMap" android:layout_width="0dp" android:layout_height="0dp" android:scaleType="centerCrop" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" app:shapeAppearanceOverlay="@style/ShapeAppearance.RoundedCornerImageView" tools:srcCompat="@drawable/map_one" />

ericktijerou commented 3 years ago

@15189611 In this case your ShapeableImageView is not visible because bottom constraint is missing.

You can actually set width and height to 0dp and set either top and bottom or left and right constraints to "parent".

There are two options:

        <com.google.android.material.imageview.ShapeableImageView
            android:id="@+id/ivMap"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:scaleType="centerCrop"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:shapeAppearanceOverlay="@style/ShapeAppearance.RoundedCornerImageView"
            app:srcCompat="@drawable/map_one" />

Have a nice day 👋