Good Morning,
I got my app to install on the Backflip and started testing it. On the emulator everything appeared ok but on the Backflip there are a few notable differences.
I have edittext boxes which on the emulator automatically vary in size to accommodate the text. The text is a number, the max being two digits, i.e., 1-99. On the Backflip the edit boxes seem to be a fixed width and that width is larger than needed. Consequently some of the edittext boxes go past the end of the screen and can't be used or seen. This doesn't happen on the emulator.
I also have spinners. One set of spinners is created using android.R.layout.simple_spinner_dropdown_item populated by an array from array.xml. These spinners have the radio button showing and they work on both the emulator and the Backflip displaying a white background with black text.
The other spinner is created using int layoutID = android.R.layout.simple_spinner_item and is populated with strings from the database using an ArrayAdapter. This spinner displays ok on the emulator with a white background with black text. On the Backflip however, it displays the white background but with white text making the list essentially impossible to see. The list is populated because when I press on an item the background color changes to red, the text is white, and the program works ok.
My question is: Are these discrepancies peculiar to the Backflip or am I doing something wrong in the code? I'd hate to think all devices come with peculiarities that require workarounds. Hopefully I'm doing something wrong and hope someone can point out what it is. I'll post any code someone wants to see but right now I don't know what to post. Thanks.
[Edit] I should add that when I use android.R.layout.simple_spinner_dropdown_item for the other spinner the text shows up ok but I now have the radio buttons which I don't want.
I should add that when I use
android.R.layout.simple_spinner_dropdown_item
for the other spinner the text shows
up ok but I now have the radio buttons
which I don't want.
Do not use android.R.layout.simple_spinner_item for the drop-down item, since that is not what it is supposed to be used for. Use android.R.layout.simple_spinner_dropdown_item, or copy that layout into your project (in data/res/layout/ in one of your SDK platform directories), modify it to suit, and use it.
As to why the behavior difference, Motorola, for the MOTOBLUR handsets, appears to have modified some of the stock resources to fit their needs. While those resources will generally work, they will only have been tested for things they are supposed to be used for. Relying on android.R.layout resources will generally work, but only if those resources are used as intended. If you want full control, make your own copy.
Related
I am trying to make an app using App Inventor.
The app has more functions, but I am stuck at the I would say "basic" one.
What I want to do is basically change the background color (or color of any element) by calling the color from list stored in TinyDB.
I have two screens Screen1 and a Menu screen.
I am tring to call TinyDB while Screen1 initializes and set background color of app on the first in the list.
Further I want to let user to choose a color from list on the other screen "Menu". After picking a color change the color on both screens.
I tried to make it following the instruction https://sites.google.com/site/blocks123/playing-with-colors , but it is little bit confusing for me.
On the printscreen i have the TinyDB blocks on the Screen1.
Is it possible on Screen1 just call/initialize TinyDB but has the TinyDB blocks on other screen "Menu"?
And when I have TinyDB and lists of color how to change the color on the chosen one?
Thank you Taifun. Your tutorial was helpful for me, evethought it is bit confusing with variables which aren´t described there. Anyway I tried to do it a bit on my way and I think I am going the right direction.
As it shown on second image I made it on the "Menu" screen and trying to save my choice to [TinyDB].
It works almost fine but except the error when "Menu" screen inicialize. I don´t understand why I am getting this message while to value is in the list? And the other way how to pass the BCurrentColor variable to "Screen1"? If I use set.Screen1.BackgroundColor it doesntWork
Well now I know I am close, I can almost fell it in the air. It is properly change background color on "Menu" screen but some how it doesn´t saves the choice to [TinyDB] as I describes at comments. Where I went wrong?
I hope when I save the color "code" to database I can call it on the other screen.
As Taifun mentioned the problem was with the variables BCurrentColor and BCurrentColorName. After I changed them to values and the trigger after selecting color from list sets it to required color.
Then I can call it from TinyDB. It works fine.
I'm playing around with Android spinners. I'm not 100% sure if I can get the behavior I want using a spinner, but it's the most obvious choice that comes to mind.
I need something of a dropdown view, the title of which says "x of y selected".
The options in the dropdown would look like:
-All
-None
-Special items only
On clicking one of the dropdown items, the title is reconfigured such that 'x' changes.
It would be ideal to use a spinner, but somehow, it seems that android puts in the first value of the spinner to always be the first values in the list of strings you pass it, and I clearly don't want the title item to be shown in the dropdown list for my case.
Another approach that I came across was to perhaps use a button with a popup with these items in the popup.
Would that be a better approach, or can I actually achieve the behavior using a spinner, or is there another view that would better serve my purpose?
I'm going to redirect to this post, after a lot of searching I found what I was looking for:
How to hide one item in an Android Spinner
The answer by Aebsubis, and make sure to set the text view height to 0. I'll update this answer with more code, once I'm done with tweaking it for my purposes.
I'm developing an application and I am facing a problem using ExpandableListView. What I'm trying to do is, in GroupHeader, not only show the group name, but also an spinner with options. That's because I want to show the football second division games in the list but, also, give the option to choose the round, in case the user wants to check older/future games. SO far I have that
As you can see both, title and spinner, shows. Also you can see the arrow on the right which is supposed to expand the list. Problem is that, if I click, only spinner opens, group expand button doesn't. So, here is my question, how can I make both of them work depending on where you click (one or another)??? Is that possible?
Also I must say that if I only place the TextView with the group name works perfect. If I only place the spinner, the problem persists. So I'm guessing that's a focus problem.
Btw: grey areas are the layout backgrounds, so no, they are not hiding behind the button.
I found the solution, I just neede to add this line android:descendantFocusability="blocksDescendants" to the Main Layout of the xml where I define the GroupHeader elements.
I have a CheckedTextBox view in my layout. When the locale selected is English, text appears at the Left side and Check box at the right side and everything works fine.
But when i selected the locale as Arabic, Arabic strings are getting displayed at the right but check box is not displaying either at the left or right.
Did any one face similar issue, please let me know the solution if any one knows.
Thanks.
I can't comment yet so I am entering this here. Make sure your layout_width is not being affected by the 'size' of the arabic text. i.e. if you are using a certain layout_width and it works with english, arabic for example might require a different point size. Something to consider...
I had the same issue with you, sometimes the checkbox was missing. I found that setting singleLine to false (and in my case, maxlines = 2 as well) did the trick.
Which version of Android do you use?
My application has a simple 'About' box.
It has a few clickable TextViews (email addresses, phone nos, addresses) all contained within a relative layout within a ScrollView (To accommodate low res screens).
The device I am testing with (Motorola Charm O.S ver 2.1 update 1) has a regular QWERTY keyboard. The problem I am facing is with the use of the arrow keys.
I want the cursor to move predictably from one clickable field to the next and this is where I need help. On the fields that don't need focus I have set the android:cursorVisible="false".I tried using the android:nextFocus* properties but still don't get the desired behavior.
The cursor gets stuck in the first field and overall the behavior is a bit unpredictable. Any ideas on how to get this done. Right now trapping the keys using code seems to be the only option.
TextView.setMovementMethod(LinkMovementMethod.getInstance())
The documentation is a little terse but it's basically what you are looking for.