Android EditText: Expand upwards - java

My EditText is expanding downwards when the input has too many characters, which leads to it being hidden behind other elements, like the keyboard. I want the user to be able to see the save and delete buttons which I have layed out below the TextView, even when a long message gets entered.
Is there any way to get the EditText to expand upwards instead of downwards?
For example, in Whatsapp entering long messages leads to the input field expanding upwards and eventually starting to scroll.

Related

How to make a RecyclerView of EditTexts act as if it were a single EditText

I'm building an Android app that syntax highlights source code files. Previously, I had performance issues with large files, so my editor is now a RecyclerView where each cell contains an EditText. While my app is performing great now, unfortunately the RecyclerView doesn't always behave like an EditText.
In particular, when I hold the EditText highlighting the word beneath my finger, and try to drag the slider past the number of lines in the EditText, I hit an impasse where I am unable to progress further:
(Sorry, wasn't able to scale the image down)
In the above image, I can't drag past the end of the highlighted region.
A similar problem happens when I:
Tap somewhere (without highlighting), and try to drag the slider down
Hold my finger, then select 'Select All'. Only what's in the current EditText is highlighted.
How do I make the RecyclerView act as if it's a single EditText? Thanks.

Android - how to turn numbers in a TextView into buttons

My utility app requires the user to select a meeting from the calendar, then it removes the non-numerical text, and parses what remains using some logic, with the final aim of identifying two numbers only.
Whenever the app fails to remain with 2 numbers only, I want to open a new activity in which the user will "tell" the app which 2 numbers are the relevant ones.
So I want to display the meeting title, location, and description in 3 TextViews but all numbers should be clickable with a special onClick action that will trigger some methods that handle the identified two numbers...
My question is about how to turn the numbers in the textViews to be clickable and have the special onClick action.
I don't think I can use Linkify as I cannot put an onClickListener on the links.
My only idea now is to turn the numbers into clickable buttons and add the relevant listener to the buttons.
1) Any suggestion on how to do this conversion other than simple step by step parsing?
2) Any better idea than using buttons?
Thanks a million
call setOnClickListener(this) on the TextView and supply a onClick method in your code

Reduce amount of spinner items

I have a huge sqlite database (round a about 450 entries)
The user has to pick one of those.
Is there a way to create a textinput field which -after 3 characters are entered- turns into a spinner, where the only elements left are the ones with those charakters starting?
I guess i would have to make a View myself, right?
On the other hand i could make a textview above the spinner, and read it out when the user clicks on the spinner, but i wanted to make it "one" element...

Update TextView numerous times with Buttons

I am making a simple shopping cart application where the user can select items (via buttons) and their running total will be displayed in a text view.
I am fine with having the text view being updated on a single click but I am struggling to figure out how to write my code if the same button is pressed more than once. For example a button writes a value of £3 into the TextView, if this button was clicked again I want the TextView to increase to £6 and so on.
Further to this I want to be able to have more than value added to the TextView from different buttons. I imagine this is more of a Java question as opposed to Android but seeing as I'm a bit of a newbie to both all advice is welcome!
Into your class if you have price value add an incerementPriceValue and make get/set functions for the last one.
If user press the button
setIncrementValue(getIncrementValue()+priceValue);
setText(getIncrementValue+simbolstring);
Create a int variable count and on the click increase the count value and set that value on the textView

Gain edittext focus tapping next in soft keyboard

I have numerous edittexts inside a listview. I want to type in each of the edittexts one by one without having to scroll through the listview. How can I do that?
Use the android:nextFocusDown param to specify which field you'd like to get focus when the user hits the enter key.

Categories