android-edittext

EditText weird behaviour in ListView BaseAdapter

倾然丶 夕夏残阳落幕 提交于 2019-12-12 12:13:07
问题 I got a ListView, populated using BaseAdapter . In the listview Item there's a numeric EditText: ... <EditText android:id="@+id/edit_quantita" android:layout_width="50dp" android:layout_height="30dp" android:layout_gravity="center" android:layout_marginTop="5dp" android:background="@drawable/edit_quantita" android:gravity="center_vertical|center_horizontal" android:inputType="number" android:text="1" android:textColor="#fff" tools:ignore="HardcodedText" > </EditText> ... When I tap on this

Multicolored edittext hint

浪子不回头ぞ 提交于 2019-12-12 12:07:50
问题 Is there a way to set multiple colors to the edittext's hint when wrapped by android.support.design.widget.TextInputLayout without compromising the behaviour of floating edittexts? like, Headline* Headline and * with different colored hint 回答1: Use SpannableString class which allows you to use different styles on parts of your string ... If I remember correctly, TextAppearanceSpan class is used for coloring a text.. 回答2: See below code this is work for me. EditText editText = (EditText)

inserting textview inside edittext in android?

a 夏天 提交于 2019-12-12 10:55:31
问题 I am trying to insert a textview inside a Edittext as in below can anyone pls give me ideas about how to implement it or something. thanks :) update: the textviews in the edittext will vary dynamically. 回答1: I think you cannot set TextView inside EditText . But alternatively you can make it look that way. Here are the steps convert textview to BitmapDrawable convert bitmap drawable into SpanableString ( ImageSpan ) then set this returned SpannableString to your EditText I have recently

Android TextInputLayout hint overlaps EditText hint

梦想与她 提交于 2019-12-12 10:43:44
问题 I am facing a weird issue, I have a InputTextLayout and an EditText in it, and I am trying to achieve something like this (shown in image below) (Image from material design guidlines: https://material.io/guidelines/components/text-fields.html#text-fields-layout), where there are two separate hints. I am doing this by adding android:hint to both layouts. This works fine, but when the focus moves away from this, the "label" moves down and overlaps the "placeholder" text. (Only when the user has

Get all the selected radio button and check box value created dyamically?

拜拜、爱过 提交于 2019-12-12 10:26:43
问题 I want to save all the selected answer(checkbox and radiobutton) and its corresponding question which is set in dynamic Textview in sqlite db , but the problem is when i am clicking "save button" only last selected radio button value is saved to sqlite , not all selected value and not able to get all selected check box value also . Please help me . save= (Button) findViewById(R.id.save); save.setOnClickListener(this); ll = (LinearLayout) findViewById(R.id.linearLayout1); for (int j = 0; j <

How to set focus to the text after the hint in EditText?

爷,独闯天下 提交于 2019-12-12 10:22:25
问题 I'm interested in you can set the focus to the text after the prompt to EditText? If no such attribute for xml layout? At the moent I still looked like this. need EDIT : The fastest and working answer given Asok I also found a similar way: EditText.append("60"); // 60 or your text in EditText 回答1: If I understand correctly you are looking to place the cursor behind the hint text, if this is correct then it is not possible, you'll have to remove hint and use setText instead, like so: EditText

Select item from spinner to show edittext

一个人想着一个人 提交于 2019-12-12 10:19:17
问题 I am trying to show an EditText when a certain Item from a Spinner is selected. So far I have created the spinner and the EditText but I don't really know what my next step is. I don't want to display the selection in the EditText, I just want to display the EditText field. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final EditText editText = (EditText) findViewById(R.id.edit_text_box); editText

Android: EditText maxLength being ignored

白昼怎懂夜的黑 提交于 2019-12-12 10:14:14
问题 I have a problem where this EditText ignores my maxLength completely. <EditText android:id="@+id/dialog_input" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp" android:inputType="numberPassword" android:maxLength="4" android:singleLine="true" android:textColorHint="@color/primary_lighter" android:textColor="@color/accent_harder" android:hint="****" /> I can input how many characters I want. This is a dialog and I cannot get the EditText by

EditText weird crash on LG Optimus w/Swype (works on emulator and Droids)

筅森魡賤 提交于 2019-12-12 09:41:01
问题 I have an app which works in the emulator and on Droid phones. While testing on an LG Optimus (which BTW has Swype installed) it crashes with the following stack trace (NOTE: it is in the constructor of EditText). What is weird is that supposed offending line in TextView (981) is the method signature for getDefualtView( ) and there are no references to GestureDetector in EditText or TextView in 2.2 source code. I'm presuming (or hazarding a guess that it is most likely due to Swype) and am

How can I set a dynamic string as an Id of an Edittext Field in android

﹥>﹥吖頭↗ 提交于 2019-12-12 09:37:15
问题 I am having Multiple Strings, that are coming dynamically, I want to set these strings as Id of the EditText Fields in my Form. How can I do that, can you please help me? For Ex: If I am having id "title", I want to set this title as id of the EditText Field, so that when I want to access the value of this field, I can access it like findviewById(title). Please help me here... Thank you so much in advance. 回答1: No , You can't set id with char , String or anything else except int ...because,