so i've learning a little about android studio recently, but every video i see, when they modify something from the "properties" window i have issues because mine says "atributes" and misses a lot of properties.
Does anyone know how to make it appear?
I have already tried a lot of stuff, like Window > restore default layout, also deleting the workspace, reinstalling android studio but i cant make it work.
I'll leave an imagen to show how i see it
https://gyazo.com/0cd32a07cefde36bb3fbbdaff5a9dff2
But every video i see has this
https://gyazo.com/300f41730bf495d8e0db05cb55d7f8d1
look at how many properties they have vs what i have, i already pressed the "view all atributtes" button
Thanks!
In Android studio 3.4.1 View -> Enter presentation mode then "attributes windows shows"
To see the "attributes" table, you only need to check the "gear" icon on that window and select "All attributes table" instead of "XML attribute table".
For more details you can check
https://developer.android.com/studio/write/layout-editor
I went into activity_main.xml, manually changed the text size of a button:
<TextView
android:id="#+id/text_view_p1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Player 1: 0"
android:textSize="30sp" />
Then I changed it back to the original size. Attributes window magically appeared again. Before I tried that, nothing else worked
Related
I have been making an Android app. Android Studio rightly scolds me if I hardcode strings in the layout editor, so I put them in res/values/strings.xml. For a simplified example:
<resources>
<string name="thing">Do a thing</string>
</resources>
I then set a button's text property to #string/thing. This correctly displays "Do a thing" in the layout editor, as expected. However, when I actually load my app on my phone with the default Run or Debug commands in Android Studio, the button is blank. This is interesting, as when I manually invoke resources.getString(R.string.thing), I do get "Do a thing" back.
I can manually set the widgets' text fields this way, by doing acrobatics like:
findViewById<Button>(R.id.myButton).text = resources.getString(R.string.thing)
but this is a lot of work that as far as I know should be done automatically. This has happened to me in a Java app too, so the problem isn't Kotlin-specific. I'm using Android Studio 3.6 on Linux and the device is a Redmi Note 3 Pro with LineageOS 16 (Pie).
The button is also blank when the app is launched in a virtual AVD, so clearly I must be doing something wrong.
Here are the full activity layout and string XML files.
Each of your Button widgets has tools:text instead of android:text:
<Button
android:id="#+id/nextButton"
style="#style/Widget.AppCompat.Button.Borderless"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
tools:text="#string/nav_next" />
android:text is used for fixed text to be displayed at runtime and, by default, in the development tools.
tools:text is for sample text to be displayed in development tools only. Mostly that is for cases where the text that you really want to use is not known until runtime (e.g., needs to be loaded from a database). Using tools:text lets you get a sense of what the layout will really look like in the tools, while not pre-populating that text when your app runs.
So, switch from tools:text to android:text and you should get the results that you seek.
I am new with Android Studio and having problem with setting the attributes e.g. The ID, adjust the constraints etc., simply because the attributes are not displayed in the attributes panel. I have tried deleting the recyclerview and re inserting them, restarting Android Studio, and even rebooting to no avail. I understand that I can set these attributes manually in the XML file but I would prefer to do it within the attributes panel.
use this to see atributes
<android.support.v7.widget.RecyclerView
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:orientation="horizontal"
tools:layoutManager="android.support.v7.widget.LinearLayoutManager"
tools:listitem="#layout/view_item" />
At the corner of the left bottom, you can see design and text, Now you are in design mode click on text mode to get exactly what you want.
Thanks.
And try this to make sure it is working properly
File > Invalidate Caches > Restart
I solved this problem by just restarting Android Studio !!!
This is strange, yet I see it all the time as I have lots of reasons to display just a simple question mark in this app.
When editing with the Eclipse graphical layout editor, everything is fine...until I tell a TextEdit or a Button to display just a question mark. Here's my code:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
>
<TextView
android:id="#+id/test_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/question_mark" />
</LinearLayout>
And the string is defined in res/values/strings.xml. The relevant line is:
<string name="question_mark">\u003f</string>
The error message I get is:
Missing styles. Is the correct theme chosen for this layout? Use the
Theme combo box above the layout to choose a different layout, or fix
the theme style references.
Couldn't find theme resource for the current theme
Change the text, and the error message goes away.
You can see that in my struggles, I'm even trying to use the unicode version of a question mark. And yes, \? doesn't work either.
Note that this only happens when the graphical layout editor is set to API 7 or greater.
Now the graphical layout editor displays the question mark properly, and the emulator and my phone display the question mark without any problems. I'm just annoyed with the error message taking up 1/4 of my screen for all my layouts (and obscuring other error messages that may crop up).
Any suggestions?
First, test this again on the ADT 21 release that shipped today.
If the problem continues, create a sample project that demonstrates the issue, and post it along with step-by-step instructions on the Android issue tracker.
Well, this is a really crappy hack, but it kind of works--if you stand on your head!
You can use the unicode \u00bf as in
<TextView
android:id="#+id/test_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="\u00bf" />
It's not a normal question mark, but it's close enough for a hack and gets that annoying error message out of your hair. And it might even increase the humor quotient of your app!
But PLEASE, if anyone out there has a real fix, post it!
Wow, I entered a bug report...[time marches on]...finally, I get a few emails as the Google team starts to look at it.
Today, I received some good news. It looks like the bug has been fixed (and they found a few related bugs, which have been fixed as well). The fix will be in the next release, Version 21.1 Preview 2. You can read the official details here.
Looking forward to it!
I have Layout xml file and when i edit it
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/image1"
android:text="llllllllllllllllllll"
android:textColor="#android:color/black" />
But it change like,
its happens when i edit xml file.and after closing xml file and i need to re-open and re-open.is there any solution ?
i already restart my eclipse but can't solve issue.And restart eclipse is not working.is
there any solution for that ?
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=375421
It is a problem with Eclipse editor which I also face often when the change is done by dragging and dropping in Graphical Layout or so. The solution I follow is to close the xml and reopen again.
This problem happens when you edit your relative layout xml file. To avoid this you can escape this component or close xml file then reopen it.
It's a bug of Eclipse
you can find here is a bug report
Also facing same problem. Sometimes need to restart eclipse also.
In my layout I have a subclass of a TextView.
<com.class.path.views.CustomTextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="HELLO WORLD!"
/>
This works fine. My problem is that the "auto complete" doesn't work. If I remove the class path and just put TextView instead the "auto complete" works like a charm again.
This isnt a big issue but it is a bit annoying when you cant remember the android:properties that you need.
So my question is should this work? is it a documented bug?
This is a known issue and this is to be fixed in ADT 12 (current latest version is ADT 11).
We've fixed a number of smaller issues in ADT 12 that don't deserve blog posts on their own, but here's a quick roundup:
...
* Code completion inside a custom view layout has been improved
...
Source: http://tools.android.com/recent/adt12bugfixroundup