I'm currently developing a note taking app. One of the requests for the app is to be able to put checkboxes (clickable, checkable) anywhere into the text like Evernote allows.
I know you cannot simply just put Views into the EditText widget. Also, the solution has to be able to serialize into a database and able to be loaded to the same formatting as it was left.
Is there a way to achieve this behaviour in normal EditText? I welcome every idea that might lead to a solution.
Have you seen rich editor library? It has a ton of functionality, including checkboxes inside EditText. I guess this one is exactly what you're looking for.
Why don't you use the CheckBox view available with android?
<CheckBox
android:id="#+id/checkbox_item"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="false"
android:onClick="changeCheckboxState"
android:text="Task 1" />
Implement the changeCheckboxState() method in your code to change checked state by using checkbox.setChecked(true) which will achieve what you want -
This way you can create a ListView/RecyclerView and attach this checkbox item to a custom adapter and keep a track of the state of the checkbox in you database
Further if you want to customise the look of your checkbox to resemble Evernote you can put it in a Linear Layout with other buttons to the right of the text in the checkbox.
Related
I need to add a spinner in my PreferenceCategory with a text on its right is there a way to do that? plus when I create a checkboxpreference the text is on the left how can I make the text appear on the right?
thanks.
If you want to use these built in controls you have to use them the way they are designed. Its also good because it fits the android design that users expect.
If you need to do something different, just make your own preference screen. Its just a list view with click handlers, not too hard to make on your own. Then you get the styling you want.
I apologize for yet, another beginner question. I have a .Net background and this is my first time with Android.
In .Net I could use panels to show/hide controls, and I'm looking to do the samething in Android.
This is what I'm trying to do: There will be two radio buttons on the top: Basic and Advanced. Depending on the radio button clicked, I want to show the relevant form. How can I possibly accomplish this?
Thanks!
you can use setvisibility for the view
you have to register for CheckedChangeListener using setOnCheckedChangeListener for the radiogroup
In the onCheckedChanged
you have to do
hidingView.setVisibiliity(View.GONE)
showingview.setVisibility(View.VISIBLE)
You could just put each one of your forms into its own FrameLayout and then use a conditional statement that checks for the state of the radio buttons. I dont know what kind of format your forms are in but Im imagining theyre probably a series of edittext boxes and TextViews. It would probably be easiest if you set it up your xml layout, declare the view to place one form and then add the other forms content to the FrameLayout dynamically in java according to the radio buttons pressed.
I am using checkbox in android and the state of checkbox is changing once i click on the text of the checkbox. "[CB] Text ". Is there any way to change this behaviour so that the state of checkbox will be changed once i click on the box and not the text.
Sorry this question would have already asked in the forum. But i was not able to find any queries related to this. Any suggestions would be really helpful for me.
-Thanks,
Ron...
The answer by jkhouw1 is the only way I can think of as well.
But please take a moment to make sure you really want this functionality. Every time you change the basic behavior of a, to the user, well know element you confuse more than you help. There are cases where you need such a change, but take a minute to make sure this is so!
Other than creating your own control, the easiest way would probably be to not display any text with the checkbox and in your layout use a textview for the text instead so you would have
[CB][TextView]
I think you are using [checkbox] [textview] in one layout tht is linear or relative,if i am right then set android:focusable = "false" android:clickable= "true" to checkbox.
i hope it will help you.
Goal: have a LIstView show a list of text strings. The user can select an item by touching it. The selected item is visibly different to those not selected.
In short I want to have a simple scrolling list box that works using trackballs AND touch mode.
There are many posts asking for this, but none seem to get an adequate answer. This is such a simple requirement, why is there no article on this?
I looked at http://developer.android.com/resources/tutorials/views/hello-listview.html but that won't work in touch mode: the orange background is displayed, something unachievable in touch mode without extreme geek wizadry, for something that is quite frankly what all newbies expect out of the box.
I suspect that the only way to achive a touch mode selectable listbox (ListView in google speak), is to stick radio buttons in there. All of a sudden my little text list view is beccoming a monster.
Can anyone explain the simplest way to do a single choice ListView that displays the item selected so the user can figure out that it is selected, in touch mode? After fumbling for days, I really am not fussed if it has radio buttons, singing cockatoos, or whatever, so long as it's simple to code.
Here's the example that Google provides:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List10.html
It uses radio buttons
Wat do u want to do? Just highlighting the row in the ListView which is selected.rt? for this u can use this.
android:listSelector="#drawable/highlighter"
android:drawSelectorOnTop="true"
Write this code in your XML file
friends,
i want to perform functionality same like stackoverflow tags as we do normally creating a question separated by commas in android.
i know we have auto complete text view in android any one suggest me can i use it for multi selection?
or any useful way to achieve this?
any help would be appreciated.
it can be achieve through two ways
i devised my own machanism so may b you people have better approach than me please share too.
1) simple
2) advance
1) in simple we can use autocomplete text view and only use single tag with hard coded values which is limitation.
2) i have used a popup page with a Edittext and add button on top and listview with checkboxes below it.
fixed items i have already loaded into list view with checkboxes so that i could select multiple tags.
and in case of if i want to add my custom tag then i use that edit text above list view and store it in temporary data and
then finally using bundle i show selected values where i want seperated by commas.
thats it.