-1

I have a somewhat complex layout.xml file (353 xml lines, 16kb) with multiple nested constraint layouts. This particular xml file is only showing a blank white screen in the design tab but works well when I run it on device and emulator. I have other smaller layout files which show the design normally on android studio but it seems that there is a bug with viewing larger xml files.

Is this a known issue? I tried refreshing layout and removing android studio cache but nothing seems to work. any ideas?

I do not think it has anything to do with the code since it runs normally on device and I am not sure posting the whole xml file on SO is a good idea.

update

What I realised is that all the elements in the layout seem to be 'invisible' at the top left corner since when I hover over them the pointer turns into a hand and when I click , certain elements get highlighted in the component tree. This is a screenshot of what I am seeing:

enter image description here

Community
  • 1
  • 1
bcsta
  • 1,963
  • 3
  • 22
  • 61
  • 1
    Make a github snippet or something and link it here for us to look at. Also take a screenshot of the design preview so that we can see it. – SnakeException Aug 13 '19 at 16:43

2 Answers2

0

I added android:visibility="gone" which is vital to my app. Little did I know that it also applies to the design view which I find to be really useless. I want the visibility to be gone during runtime, not on a platform where I am supposed to be tweaking the design of the UI. This is ridiculous to me.

Does anyone know If I can keep visibility="gone" but still see the design in the design view of the layout?

bcsta
  • 1,963
  • 3
  • 22
  • 61
0

You can use tools:visibility="visible" for designing purposes. It has zero effect on the view in real use.

Don't forget to keep your android:visibility="gone".

In general, use tools attributes whenever you'd like to manipulate a preview in the designer while keeping your view attributes valid for real use.

Edit:

Keep in mind that there is a huge difference between invisible and gone. More about that

San Mo
  • 288
  • 2
  • 11