Android Layout Auto Complete fail when using custom component - android

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

Related

Android studio properties window not showing

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

Why is my layout preview in Android Studio empty?

My issue is similar to this but Android Studio doesn't tell me anything about a rendering issue or compiler/build errors(I was able to build fine).
Here is what I am seeing(this is a new project)
And the contents of content_main.xml
After reading on different rendering issue threads, I I've tried rebuilding, cleaning, invalidate caches/restart and even starting a new project to see if the layout preview was working(Still empty)
I also played around with different sdk versions(20,19) to see if the layout preview was working but all I got was this quirky issue that I don't think would cause the layout preview to not work.
Does anyone know what my problem is here? I didn't mess around with my initial Gradle files and remove any support library dependencies. Another solution I had in mind was reinstalling Android Studio but that's last resort.
Just check your sdk valid version like example.
Try putting your TextView element into an empty FrameLayout:
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/my_groups" />
</FrameLayout>
This code above should be put inside your RelativeLayout. Hope it helps.

Tools namespace android listitem

I'm trying to use the "tools" namespace feature in Android Studio.
I'm trying to populate the ListView with dummy list items, for design purposes. The link here says the tools:listitem="#android:layout/<filename>" should do.
But for some reason, Android Studio keeps showing Layout android:<filename> does not exist. I'm trying to find a solution for it, so I don't have to run my app again and again with dummy values for testing.
I might be overlooking something very foolish, so forgive me. Here is what I have for now:
<ListView
android:id="#+id/controllerProfiles"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
tools:listitem="#android:layout/profiles_list_item"/>
And I have a file profiles_list_item.xml under res/layout. Any suggestions or alternatives?
you should change the following line :
tools:listitem="#android:layout/profiles_list_item"
to this :
tools:listitem="#layout/profiles_list_item"
with #android you say that you want to use a layout from android resources but your layout is in your own project files.
tools:listitem doesn't work with ListViews in Android Studio 2.2. This is a known bug. I've tested this in Android Studio 2.3 beta 1 and it is fixed here.
You can also move from ListView to RecyclerView as this bug doesn't occur at RecyclerViews.

Widget changed appearance with 4.4

I have a very basic widget with two buttons in a layout. They look like standard android buttons, but with the 4.4 update the buttons now appear as a dark grey instead of light grey. They remain normal in previous versions of android. Does anyone have any idea of why this is happening and how I can fix this?
Thanks!
Button xml:
<Button
android:id="#+id/button_widget_newshift"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="1"
android:text="#string/new_shift_split"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#101010"
android:textSize="#dimen/widget_text" />
I don't have an answer (and I don't have enough of a reputation to post a comment). I have the same problem, although I'm creating my buttons in code. They work on devices prior to 4.4, but are dark grey and borderless on my Nexus with 4.4 and a 4.4 emulator.
I understand that 4.4 changed drawables to tone down touch feedback (see http://developer.android.com/design/patterns/new.html). Perhaps, in the process, a button style or drawable got misplaced. If so, a solution/kludge might be to copy working resources from the SDK into your project and call setBackgroundResource() to them. I haven't tried this; I'm hoping someone can come up with something more elegant and definitive.

Android Layout Editor Freaks Out on Question Mark

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!

Categories

Resources