Skip to content Skip to sidebar Skip to footer

Textclock Render Problem In Layout Preview

When i created TextClock widget in layout Android Studio layout preview cahsed and didn't show the changes. But on debug devise widget work perfectly. If I commented it layout prev

Solution 1:

Comment your TextClock and refresh your preview, and then uncomment your TextClock. This will fix your issue.

I encountered this problem when I upgraded to AS 3.6.1

Solution 2:

A fix/workraound is to create a subclass of TextClock and add this into the created subclass:

@OverrideprotectedvoidonAttachedToWindow() {
    try {
        super.onAttachedToWindow();
    } catch(Exception e)  {
    }
}

Source

Solution 3:

I had the same problem; my workaround was to convert the TextClock to a TextView via rightclick -> convert view as TextClock extends TextView, then the Layout renders, and after the Layout rendered I converted it back to a TextClock.

It's an ugly workaround - not a fix (you have to repeat it after closing Android Studio) - but at least I can see the layout now.

I will report it to Android Studio as a bug and hopefully they fix it

Post a Comment for "Textclock Render Problem In Layout Preview"