android-edittext

Possible to open “Speak Now” dialog programmatically?

只愿长相守 提交于 2019-12-06 08:03:17
Is it possible to open the "Speak Now" dialog programmatically? Currently, if the user taps my 'Search' button, a dialog opens and I have the soft keyboard open automatically so the user doesn't need to tap the textedit field. I'd like to offer an alternate 'Search by voice' that will open the dialog and have the "Speak now" window open automatically. So the user doesn't have to find and tap the 'mic' button on the keyboard. Any ideas? Yes, it is possible. Take a look at ApiDemos sample in the Android SDK. There is an activity named VoiceRecognition , it utilizes RecognizerIntent . Basically,

How do I draw a EditText to canvas in android?

做~自己de王妃 提交于 2019-12-06 07:54:56
问题 I would like to draw EditText username = new EditText(context); to a specific spot on my canvas in protected void onDraw(Canvas canvas) { } Is it possible to draw it on the basis of x,y coordinate in my Java file without using XML layout? 回答1: Yes you can draw EditText on Canvas , Here is hint: EditText ed; . . . . . ed.setDrawingCacheEnabled(true); Bitmap b = ed.getDrawingCache(); canvas.drawBitmap(bitmap, l, t, r, b, null); You can create/initialize EditText at run time like this: EditText

Android Development: How To Get All EditText Children of a ViewGroup?

安稳与你 提交于 2019-12-06 07:54:41
Basically, I have a LinearLayout that holds a random amount of horizontal LinearLayouts, and in each of the horizontal LinearLayouts there's a TextView and an EditText. I want to be able to get the value of each EditText children of the master LinearLayout. Sorry if it's confusing, I'm no good at explaining things! Could I just set the same ID for each of the EditTexts then use findViewById, or would that only return the first instance of an EditText? Thanks, Alex. You would need to call findViewById on each of the LinearLayouts. If you do this, you can set the same ID for each EditText.

Combining EditText and Button?

冷暖自知 提交于 2019-12-06 07:15:47
问题 In some apps I see an EditText widget combined with a Button on the right side (e.g. the search field in the twitter app). How can I create a widget like that? Regards, Marco 回答1: I finally found a solution. Here's how the google guys did it: search_bar.xml Thanks for your help! 回答2: Check out the TableLayout and the RelativeLayout in the Android developer center. There are a few more official tutorials on layouts here. If you use the TableLayout, you can put an EditText in the left column of

Android views' borders issue on some devices

给你一囗甜甜゛ 提交于 2019-12-06 07:02:29
TOPIC Solved: Answer below. Some users have been reporting border alignment issues on some android components such as the alert popup or the editTexts. This is happening on the Samsung Galaxy Apollo (200x400) and the HTC Pro Touch (480x640) devices. I cannot replicate that because i don't own those devices and in the Samsung Galaxy S and emulator everything looks just right. I think that the problem is the dpi or resolution of the device (because the edittext background is a single .9.png so image should look ok); however I am not sure if the supports-screens tag is the solution. Also,

Android Development: Count EditText Lines on textChanged?

霸气de小男生 提交于 2019-12-06 06:30:48
问题 How can I count the number of lines in an EditText? Basically in my app I have line numbers and I wanted to make them update on textchange (I already have the textchangelistener set up). Is this possible? :( Thanks, Alex! 回答1: Lines can be differents: Visible lines: Wrapped text count as a new line... List item: Only lines with \r, \n, \r\n First case (the easiest): int nbLines = editText.getLineCount(); Second case: int nbLines = 0; StringReader sr = new StringReader(editText.getText()

Is it possible to create a custom floating text selection menu in Android versions pre Marshmallow?

旧时模样 提交于 2019-12-06 06:04:01
问题 I'm looking to create a custom menu for text selection. I know it's possible to edit the behaviour of the action bar with setCustomSelectionActionModeCallback, but in my case I don't want that action bar to show at all, I want my own floating custom menu which I have already achieved. Only thing is that there is no way to not show the action bar menu after selecting the text in the TextView. The behaviour I need is not the standard cut/copy/paste, the actions I have implemented are for

Android : EditText with custom keyboard

末鹿安然 提交于 2019-12-06 05:45:45
问题 I created my own custom keyboard following the the example in the sdk. Now I would like to use this custom keyboard by default on my EditText in my app (actualy I have to long press the edittext and then choose my custom keyboard ). How can I do that ? (seems to be related to the inputType property but I can't find out how to set it) Thanks ! 回答1: How can I do that? Have your users set your keyboard to be their default. Applications do not have control over that. 回答2: If by saying "I created

Android - How To retrieve EditText value from RecyclerView in MainActivity

橙三吉。 提交于 2019-12-06 05:31:32
问题 How can I retrieve the value from all EditTexts created by the RecyclerView in MainActivity? In my RecyclerView Adapter I'm extending my inner class: public class MyPersonalAdapter extends RecyclerView.Adapter<MyPersonalAdapter.MyPersonalViewHolder> I'm getting a reference to the EditText in that inner class: class MyPersonalViewHolder extends RecyclerView.ViewHolder { TextView numberTextView; EditText nameEditText; public MyPersonalViewHolder(View itemView) { super(itemView); numberTextView

Validation in EditText allow IP or web Url host

心已入冬 提交于 2019-12-06 05:05:19
问题 I am in need to give validation on my EditText such that it allows me to enter a valid ip address format ( ?.?.?.? ) ie example 132.0.25.225 or web url format ( www.?.? ) ie example www.example.com logic is that if user type any numeric value first then validation(IP) will do action else user must write "www" before any web String Note : it must perform onKeyListener() of EditText, i mean while user giving input In short - I am not going to check when user completes input and press OK button