Mark M. | has entered the room |
Mark M. | turned on guest access |
Mar 13 | 10:05 AM |
Ron T. | has entered the room |
Mark M. |
howdy, Ron!
|
Mark M. |
how can I help you today?
|
Ron T. |
Hi! I have a question regarding the default colors on the edittext control...
|
Ron T. |
On two of my devices, when the edit control is
selected there is a blue border but on one device there is an orange
border. I thought that the default is orange?
|
Mark M. |
themes are under the control of device manufacturers
|
Mark M. |
they also shift occasionally in Android itself (e.g., Honeycomb)
|
Mark M. |
that's part of the reason why ICS mandates that device manufacturers leave alone Theme.Holo.*
|
Mark M. |
so apps using it have a consistent look across devices
|
Ron T. |
My devices with blue are running 2.3.3 and 2.2.1. My Orange device is running 3.2.1
|
Mar 13 | 10:10 AM |
Ron T. |
When I develop, I am targeting 2.2
|
Ron T. |
My real problem is...
|
Mark M. |
your build target has nothing to do with it
|
Ron T. |
My customer wants his app to have blue borders. He
also wants the controls to have rounded corners. I've google'ed alot
about the rounded corners and found an entry from 2010 with some code
(XML) and some comments by you regarding the selector states. All that
works fine but... when I implement it, the blue borders change to orange
on those devices!!!
|
Mark M. |
the borders are formed by the background of the widget
|
Mark M. |
which is a StateListDrawable, typically defined in XML
|
Mark M. |
the StateListDrawable points to other images (typically nine-patch PNGs) for each specific state
|
Mark M. |
so you are in control over what the colors are
|
Mark M. |
by simply creating or choosing the right nine-patch PNG files
|
Mar 13 | 10:15 AM |
Ron T. |
What is the best way to implement rounded corners and a blue rather than orange selector scheme?
|
Mark M. |
I pretty much just wrote that
|
Mark M. |
create a StateListDrawable, either copying from the SDK or one from scratch
|
Mark M. |
create nine-patch PNG files for your rounded rectangles, incorporating colors as needed, for each state
|
Ron T. |
Yes, I saw your comment in the google about the
png files. So... I will have to point to a custom set of PNG files that
have the blue colors, correct?
|
Mark M. |
(or copy the ones from the SDK and modify them)
|
Mark M. |
yes
|
Mark M. |
bear in mind that themes shifted significantly from 2.x -> 3.x -> 4.x
|
Mark M. |
so you might wind up with a couple of these (e.g., res/drawable/ and res/drawable-v14/)
|
Mark M. |
in order to have stuff that looks right when applied to the base theme that the app runs upon
|
Mark M. |
EditText widgets, for example, no longer have full borders when they are not selected
|
Mark M. |
ideally, you just leave it all alone
|
Ron T. |
Yes, copy them and place in the drawables/res. The
google example had the XML for the rounded corners and it worked fine. I
was just trying to figure out why the color changes from blue to orange
when there is no orange color designation in the XML that does the
rounded corners?
|
Mark M. |
the XML won't have orange -- a nine-patch PNG file will have orange
|
Mar 13 | 10:20 AM |
Ron T. |
So, if I copy the PNG and modify the color on the copies then reference them I should be good to go, correct?
|
Mark M. |
yes
|
Mark M. |
for example
|
Mark M. |
in android-9, we have: <item
android:state_enabled="true" android:state_focused="true"
android:drawable="@drawable/textfield_selected" />
|
Mark M. |
as part of the StateListDrawable that is an EditText's background
|
Mark M. |
if you examine textfield_selected.9.png, you will see the orange highlight
|
Ron T. |
One final question: What is the best way to modify the PNG? I'm a rookie at image modification!
|
Mark M. |
best answer is to hand it to the graphic designer
|
Mark M. |
second best answer is to use an image editor
|
Mark M. |
a nine-patch PNG file can be edited using any PNG-capable editor, from MS Paint on up
|
Mark M. |
just leave the 1-pixel-wide border around the edge alone
|
Ron T. |
I will see if that is possible but it may not be
as we are not in direct contact with them. I would prefer to do it that
way (They gave me the background images for the Activities a while back)
|
Mark M. |
(unless you want to change the stretching rules,
in which case the draw9patch utility in the Android SDK is the best tool
for adjusting that border)
|
Ron T. |
Okay.
|
Ron T. |
So the blue on some device and orange on others is due to the device mfgs, correct?
|
Mark M. |
yes
|
Mar 13 | 10:25 AM |
Mark M. |
basically, they changed textfield_selected.9.png
|
Mark M. |
(or the equivalent)
|
Ron T. |
Okay! Thanks for your help! I will continue. May touch base with you again on Thursday. Over and out!
|
Mark M. |
Thursday's chat is at 4pm Eastern
|
Ron T. | has left the room |
Mar 13 | 10:30 AM |
Al K. | has entered the room |
Mark M. |
howdy, Al!
|
Mar 13 | 10:35 AM |
Mark M. |
how can I help you today?
|
Al K. |
hello.
|
Al K. |
I am trying to define a service inteface using AIDL.
|
Al K. |
This is what I wanted to define:
|
Al K. |
Map sendToCommandCenter(in Map message);
|
Al K. |
I am having trouble with the code generated from the aidl file.
|
Al K. |
The generated code has an undefined variable if I use Map as the return type of the remote method.
|
Al K. |
I am using the Eclipse IDE with the android plugin.
|
Mark M. |
that problem sounds familiar
|
Mar 13 | 10:40 AM |
Mark M. |
hold on one moment while I do a bit more research...
|
Al K. |
Ok,
|
Al K. |
This is a fragment of the generated code:
|
Al K. |
_result = _reply.readHashMap(cl);
|
Mark M. |
and there is no cl
|
Al K. |
where the variable cl is undefined .
|
Mark M. | |
Mark M. |
that would appear to be a bug in the tools, though I do not see an issue for it on b.android.com
|
Al K. |
Ok, I see this has happened to others.
|
Mark M. |
you might try switching to returning a Bundle
|
Al K. |
Ok, I'll look into that. Would returning a List also work?
|
Mark M. |
I will also make a note to give this a try and
file a b.android.com issue if I get the same results as you and that
android-developers post from November I linked to above
|
Mark M. |
a List might work, but I assumed you needed a Map-like structure
|
Mark M. |
Bundle looks a lot like a Map
|
Mar 13 | 10:45 AM |
Al K. |
Another naive question. What are the restrictions
on out and inout parameters? Do they need to occur in a certain order?
Would Map as an out parameter by a possibility?
|
Mark M. |
I am not aware of any ordering requirements
|
Mark M. |
however, I am unclear if Map can be used as an out parameter
|
Al K. |
Ok, thanks for your help.
|
Mark M. |
this thread suggests there are problems with Map as an out parameter: http://groups.google.com/group/android-dev…
|
Mar 13 | 11:00 AM |
Mark M. | turned off guest access |