3

I opened a blank Android application in Android Studio and when I attempt to edit a button, the attributes are not present. I'm new to Android development and following a guide which shows how to change the text in the button, but the attributes menu lacks the options seen in the guide.

Using:

  • Android Studio 3.2.1
  • Gradle 4.6 (Updated from 4.5)
  • Android Plugin Version 3.2.1
  • Windows 10

I updated Gradle and did Invalidate Caches/Restart with no change to the interface.

How my interface looks:

enter image description here

How the interface should look:

enter image description here

A similar situation that did not resolve my issue.

The revlavent XML file which was created via Android Studio's default file templet

      <?xml version="1.0" encoding="utf-8"?>
      <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
          xmlns:app="http://schemas.android.com/apk/res-auto"
          xmlns:tools="http://schemas.android.com/tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          tools:context=".MainActivity">

          <Button
              android:id="@+id/button"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginStart="8dp"
              android:layout_marginEnd="8dp"
              android:layout_marginBottom="8dp"
              android:text="@string/button"
              app:layout_constraintBottom_toBottomOf="parent"
              app:layout_constraintEnd_toEndOf="parent"
              app:layout_constraintStart_toStartOf="parent" />

          <EditText
              android:id="@+id/editText"
              android:layout_width="wrap_content"
              android:layout_height="0dp"
              android:ems="10"
              android:inputType="textPersonName"
              android:text="Name"
              tools:layout_editor_absoluteX="181dp"
              tools:layout_editor_absoluteY="337dp" />
      </android.support.constraint.ConstraintLayout>
Ciccarello
  • 48
  • 1
  • 6
  • Double check your button Text color is not the same as your button background – shizhen Dec 31 '18 at 01:05
  • I wouldn't be able to change the text color if I wanted too as the attribute to change such a value is not present. Here is an example with plain text https://i.imgur.com/BXLi1nq.png – Ciccarello Dec 31 '18 at 01:09
  • can post your layout `.xml` file? – shizhen Dec 31 '18 at 01:10
  • I believe this is what you are looking for https://i.imgur.com/HjOZgeA.png Bare in mind this is a blank file freshly created using Android Studio's default file. – Ciccarello Dec 31 '18 at 01:19
  • don't post image here, but update your questions with the text content. – shizhen Dec 31 '18 at 01:24
  • Updated post. Also thank you for posting my images. It was bothering me not being allowed to post images due to being new. – Ciccarello Dec 31 '18 at 01:31
  • Noticed that there is a minus `-` in the second line of your xml file, try to remove it to see anything will happen. – shizhen Dec 31 '18 at 01:36
  • I originally opened the code in IE to quickly copy it, I opened it in Atom this time to edit it, and that minus is not present. I updated the code to show it better and hopefully more accurately. – Ciccarello Dec 31 '18 at 01:58

3 Answers3

9

Please try this first check if there is any anomaly in your XML code! if yes then fix it first and then GOTO File > Invalidate Caches and Restart. After restart note that it takes a little more time to start but this will surely fix your issue.

and if that does not then use this

EXTREME STEP

Well there are plenty of solutions to deal with android studio designView Rendering.

what i used to do in my utmost cases when i was kind of on low spec system is something like this

if WINDOWS is your OS then just follow the steps:

1: Close your Android studio if running

2: Make sure no shortcut icon is present in the bottomBar or desktop(optional)

3: Open C:/Users/{your_USER_NAME}/ and just delete .AndroidStudio{VERSIONCODE} folder

what does this folder do? well it saves your custom android studio themes, styles, shortcuts etc

after deleting it

4: Check you are connected to Internet

5: open the android studio and it should present you with again setting screens like what theme you would like to use etc! just go with recommended

6: follow the recommended steps at first after that if anything android studio is missing it will download!

7: try creating a new project then!

REMEMBER you do not need to remove .gradle for just simple UI/UX glitches of android studio! just remove .androidStudo3..(

Rizwan Atta
  • 3,222
  • 2
  • 19
  • 31
  • Thank you! Removing the .AndroidStudio folder resolved the issue. I loaded the most default settings I could including using not Darula (ew) and whatever was the default Android version it wanted. The attributes showed up properly. Then I opened the project I was already working on, and the attributes persisted. I will keep that trick in my bag for the future headache inducing issue. – Ciccarello Dec 31 '18 at 02:06
  • 1
    please upvote and accept the answer then! thanks @Ciccarello – Rizwan Atta Dec 31 '18 at 02:06
  • 1
    @Ciccarello glad that it helped! – Rizwan Atta Dec 31 '18 at 02:10
1

Got the same issue, it is fixable. I usually get this problem when i have too big .xml files.

First solution (Online) Just delete the following folder.

C:/Users/USER_NAME/.AndroidStudio3.x

If you have more than one, you usually have to delete just the newest one. The other ones aren't usually used anyway.

Second solution (Offline) Create a new Project and just copy all the needed files inside.

Andrea
  • 1,286
  • 6
  • 18
0

of your backup of the .idea folder within the project. Replace all files inside. Then open the project and Sync Project with gradle files.