I have a long string in my android app that looks like this:
<string name="imprint_text" translatable="false">
...long text here...
</string>
The problem is that Talkback is only able to read the whole string from the beginning, indifferent of where on the screen you touch. What is the best way for this to be split into different paragraphs? Should I just create different strings (imprint_text1, imprint_text2...) and bring them in the correct order or is there a better way to do this?
Unfortunately, I don't think that this is possible. Keep in mind that there's also a limit of 4000 characters if I'm not mistaken. My suggestion would be to use TextToSpeech. You can start it when the user opens the screen or when they tap on anywhere (probably the first one would be better, but it depends on the app). It has a lot of options for setting the speed and even a playSilence method.
Related
I am very new to Android programming, but would like to change the style of my Switch View element so that it looks similar to the one that is displayed on the Android website:
and not like the one that I currently have:
I assume that because this is on the Android website it would not be difficult to change to this Switch style, but as I am new to Android development, I don't even have the faintest idea how to change this, and a large amount of time spent searching for the answer has not turned anything up as to what is causing my style to differ from the one on the website. Any help is welcome, thank you!
That's actually different enough that its going to be a pain- particularly the text on top of the switch instead of to the side. But lets ignore that and assume you only want to get the rest of the look, that you don't want words (words on a switch are a bad idea anyway, the word for "on" might be 7 characters in some language).
You can set the thumb drawable in xml via android:thumb. You can set the drawable for the background with android:track. If you want the side of the long area of the thumb to change,(its on top in your drawing on "on" and the bottom on "off") you'd need to change the thumb drawable when the state changes. The tinting of the thumb/track are controlled by android:trackTint and android:thumbTint.
You can see the other switch-specific xml properties at https://developer.android.com/reference/android/widget/Switch.html
I'm working on creating a basic user interface and I wanted to try and create a portion that is in a scrollTaskPane and is capable of holding multiple entries. As I'm going about creating it I can obviously test it with a simple amount of entries but I'm confused how I can go about later allowing for it to take input to create entries in the scrollTaskPane of maybe 1 entry one time, and then later needing to allow for input of 20 entries. I only know how to use absolute positioning and am trying to figure out the best way to go about it. I also need to later be able to select each entry.
For the entries that will eventually be called and displayed in my interface, I'm planning to store them in a simple text file and use a semicolon as a delimiter between the task "Type" "Name" "Description"(which will be accessible through a button) and "Due Date". Or I may try to learn to use a database for the information. But I haven't decided yet and don't know anything about connecting a database with a java program.
This is the current look (the scrollTaskPane in the middle). And my goal is to put in entries that are each rectangle boxes going across the scrollTaskPane with a checkbox on the end of them. Should I use some sort of grid layout? Or something else? I'm a beginner at user interfaces, so any help is appreciated!
You can make a custom layout, and then keep adding those layout. So extend a layout class, add TextField and a check box in the layout. Initialize the layout with your values, add then add to the ScrollTaskPane.
I would like to see visually how much space each box takes with as little effort/changes to the code as possible.
I would like to know if it's possible to just put a line around the outer margins of the View or ViewGroup object.
Since it's just for debugging and styling I would like to also quickly turn it off, so I do rather make the changes to my code in one place so it's easy and quick to undo. Is this a default option I am missing? Somehow I expect this feature to exist already.
Here someone asks a different but slightly related question with not a nice answer for my case.
Here someone gives an answer on how to outline one View.
Border for an Image view in Android?
Code-wise you could follow the answer to the first link you posted and create a drawable with the name "developer_borders" or something similar and apply it to every view you wish to have its borders visible.
To easily remove it afterwards, you can right-click the directory of your project and click Replace in Path.... For Text to find you want to search for android:background="#drawable/developer_borders and for Replace with don't use anything. This will find every occurrence of what you are searching and replace it with an empty string.
There might be an easier option. Some devices have quite powerful Developer Options. "Show layout bounds" is what you want but take a look at the rest while you are at it, some are pretty awesome.
I have a number of editText's in my view and I want to be able to make some adjustments to the keypad that points up for the user when they highlight the EditText.
In particular
- Making a capitals only keypad?
- Removing the auto-correct feature?
- Adding non-english characters to the first screen of the keypad e.g. "ñ"
Is there a simple approach for changing this keypad?
In general, you don't have that much control of the on-screen keyboard that is displayed to the users. However, turning off autocorrect and making all characters capitals is a possibility, you simply need to set the android:inputType attribute in your XML. Here are the values that you can use (you can also OR | them). It would look like android:inputType="textCapCharacters|textNoSuggestions".
I wouldn't worry about the Ñ or other weird characters. Most of those are easy to get by just long pressing on a key (in this case, the N).
I have a large set of data from which the user has to select one. I'm thinking of a way to implement it (of course, in a GUI). I have a few ideas. But just thought of posting here as there may be better alternatives..
Say, user has to select a name from a large set of user base. If I simply put a text field for user to enter the name, then there can be issues like entering same name in different formats, misspelling etc...
I see two options here
Using a combo box
Using a list (Actually i'm thinking of something like a tool tip. As I cant show the whole list always due to space issues)
But combo box won't be much user friendly i guess. As the user will have to scroll around the whole list to select an entry. If the number of entries are too large, this will be
Which means, now I'm left only one option. A popping up list, which will change the content according the text user is entering in the text field. So he can type first few letters and the list will show all the entries starting from the entered text. Got my point, right?
Are there any other better to achieve this kind of need?
If I'm going to implement above, what will be the best way to follow. I'm thinking of extending the JTextField to add required functionality. Well, I'll put some method to set the popup list entries. And I'll add some actionListner to watch the text field, and control the popup list accordingly...
Autocomplete is what you are probably looking for. Google for "java swing jcombobox autocomplete" and limit results for the last couple of years to get relevant results. There will be a lot of examples and ideas on how to implement this with custom code.
I believe there is also some custom libraries like "swingx" that provide at least partial or full implementations to save time.
http://swingx.java.net/
They have released code as recently as the beginning of this years so it appears active and might have what you need.
You could take a look at SwingLab's autocomplete feature, it allows you to attach it to a JCombBox, JList or JTextComponent
use AutoComplete JComboBox/JTextField
based on Standard Java Classes
no issue with larger sets of data
no issue with Focus, BackSpace Key, Caret
for better performance to required sort the array before use
simple workaround for setStrict(true/false), restrict input to array