0

New to AS, following the official "Build a simple user interface". In "Add a text box", 3. Click the view in the design editor. enter image description here

I am in Design tab, but unable to find view. Google found this in SO, it says view is actually Preview. Ok, this is my screens, after toggling to Text and came back, Preview shows up in the menu but disabled. enter image description here enter image description here

Is it because I have 3 warning and error at upper right corner of Design mode? enter image description here

Clicked on this warning/error popup, clicked on the blue underline for each warning/error, it would go away until a "no warning" bell replacing the red "3", still Preview is disabled.

Environment is Windows 10 Pro, AS version 2.3.3

This is very inconsistent and buggy.

Community
  • 1
  • 1
Jeb50
  • 6,272
  • 6
  • 49
  • 87

5 Answers5

0

It's not a bug. Read the error carefully. You might not be aware of ConstraintLayout.

It's like a Relative Layout on Steroids.

This tutorial might help.


Here, you need to provide at least one Horizontal and one Vertical constraint to your view in order to position it to your desired location on the screen.

Daksh Gargas
  • 3,498
  • 2
  • 23
  • 37
  • 1) Read the error carefully. Eliminated all error at the upper corner, so the red 3 became a bell, see original screenshot. Still no "Preview". Toggled to Text view then back to Design view, "Preview" shows up even though is gray out in the View menu. Notice nothing was added/changed. 2) Read the recommended Tutorial, not quite sure where to add constraint, in the Text view's XML? Thanks – Jeb50 Oct 14 '17 at 23:44
  • Wait, what? You still didn't get it? Wow. – Daksh Gargas Oct 15 '17 at 02:31
  • Maybe you should use `RelativeLayout` instead. – Daksh Gargas Oct 15 '17 at 02:33
0

I think that's because you are at design editor. Switch to text editor and you will see the preview on your right.

zero_yu
  • 493
  • 5
  • 15
0

You are here:

enter image description here

Click on Layout > Design

enter image description here

Now select the text box, by clicking on it:

enter image description here

And you will get what instructions are explaining:

You can now see the resizing handles on each corner (squares), and the constraint anchors on each side (circles).

Suleyman
  • 2,765
  • 2
  • 18
  • 31
0

I had the same problem - just starting and it was confusing. The error needs to be fixed first, and I found the solution on another thread: Failed to load AppCompat ActionBar with unknown error in android studio

Basically modify /res/values/styles.xml from:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>

to:

<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">
</style>
Johan
  • 1
0

It's simple, just be on the same Blueprint and then click on the plain text constraint. enter image description here

And it will be something like this with some circles (Anchor) and some resizable edges. then move the anchor to the Top until you get a 16dp text in between your plain text constraint and the top margin, do the same for the left side view also. Once you have followed the instructions it will look something like the above image.

Laurenz Albe
  • 209,280
  • 17
  • 206
  • 263