android-edittext

Custom editText on android

醉酒当歌 提交于 2020-01-05 12:09:45
问题 I'm newbie with android layout, so i need some help. I want create a custom editText, something like this: I'm want to fix that with the best possible way. Someone? Thanks. 回答1: If you want the blue line on the left, you can just set the background on the EditText, such as, <EditText android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/custom_edittext" android:layout_weight="1" /> Then create another file in your

Can't get String which is entered into Edit Text in ExpandableListView(Not the usual Focus issue)

让人想犯罪 __ 提交于 2020-01-05 09:22:32
问题 Hey so basically I have a Sign-in/Register screen for an app and I have to make it using an ExpandableListView as shown. Based on the position of the child in a group I have inflated different views. So for positions 0 and 1, I have inflated 2 different EditText boxes. My problem is I can't get the text that is typed in both the boxes. The box allows me to type continuously but when I click the Sign-In button, the strings I get from the username and password boxes using getText are both null!

Can't get String which is entered into Edit Text in ExpandableListView(Not the usual Focus issue)

感情迁移 提交于 2020-01-05 09:21:04
问题 Hey so basically I have a Sign-in/Register screen for an app and I have to make it using an ExpandableListView as shown. Based on the position of the child in a group I have inflated different views. So for positions 0 and 1, I have inflated 2 different EditText boxes. My problem is I can't get the text that is typed in both the boxes. The box allows me to type continuously but when I click the Sign-In button, the strings I get from the username and password boxes using getText are both null!

Programmatically resizing EditText on orientation change

旧时模样 提交于 2020-01-05 08:21:55
问题 I'm trying to programmatically resize an EditText when the orientation of the phone changes, here's what I have so far: private final float editTextWidthLandscap = 380; private final float editTextWidthPortrait = 220; @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); Resources r = getResources(); float px; if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) { px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP

EditText that looks like TextView inside a ListView

耗尽温柔 提交于 2020-01-05 03:33:09
问题 I am developing an application where the user can edit the data in the ListView . I want to have an EditText inside that ListView, this edittext should behave like TextView but when the user clicks it it should look like EditText , How can i achieve this functionality? Actually the EditText inside the ListView looks ugly & i want that the EditText should look like a TextView bydefault but when the user try to Edit the data then it should look like the EditText. I hope that my question is

Setting attributes of an EditText added dynamically in Android

懵懂的女人 提交于 2020-01-05 02:23:07
问题 I am developping an android app which downloads an xml and displays a layout with a number of edittexts, checkboxes, spinners, etc. added dynamically like this: LinearLayout ll = new LinearLayout(this); EditText nameField = new EditText(this); ll.addView(nameField); ScrollView sv = new ScrollView(this); sv.addView(ll); setContentView(sv); I'm having trouble with setting some properties to an EditText added this way. For examle android:maxLength attribute can easily be set in an xml layout but

Softkeyboard not showing in a AlertDialog

那年仲夏 提交于 2020-01-05 01:09:09
问题 So i have a menu item that shows AlertDialog with a EditText in it, the problem is that although it is focused the softkeyboard doesn show until I click on the edittext, anyone got a solution ? I tried InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(yourEditText, InputMethodManager.SHOW_IMPLICIT); but it doesn work. Here is my code @Override public boolean onOptionsItemSelected(MenuItem item) { return (applyMenuChoice(item) ||

make Android Textview or EditText selectable

痞子三分冷 提交于 2020-01-04 14:18:42
问题 I want to make EditText or Textview selectable in my android project . project is for android 4.0+ . I add this : txtView.setTextIsSelectable(true) and also : txtView.setCustomSelectionActionModeCallback(new myCallback()); to make my custom selection menu . but this error happend when i want to select the text . W/TextView﹕ TextView does not support text selection. Action mode cancelled. i searched about the error but didn't find the solution .what should i do ? 回答1: <TextView android:id="@

android EditText's background

拜拜、爱过 提交于 2020-01-04 05:39:09
问题 I would like to set to my EditText background . Hm ... I don't know even how to explain .... When there is a lot of text vertical scroll enables ... I need to 'scroll' the background when user scrolls the text (Now I have that when user scrolls the text background is fixed, so text became crossed by lines of background) Have you any ideas? 回答1: Create a drawable in xml like this for lines as mybackground.xml, where @drawable/divider will be your line image with the prefered space between

Make EditText accept non-English numbers

时间秒杀一切 提交于 2020-01-04 05:22:27
问题 I made a very simple app that involves only numbers and there is no need to make different locale folders or anything. When I test the app, the EditText will take numbers when the keyboard language is English, but when I change the keyboard to other languages it does not work! pressing a number will not show up in the EditText . Is there a way to make the EditText take universal numbers regardless of the language? 回答1: I think it will work <EditText android:inputType="numberSigned