Skip to main content

Edit Text Problem in android

Problem Statement 
I had set background image for EditText. But when the user clicks on EditText the starting point of cursor is appeared before the EditText background image and it looks abnormal.






Solution  A:

Set the EditText left padding


Solution  B:

Use the 9 patch background image

Note:if there is  any other solution please  share with  me .Thanks 

Comments

Popular posts from this blog

Exclamation Mark with Android Project Name in Eclipse

Solution A Check errors window. Try to solve the error there Solution B Right click the project,  select Android and make sure that a build target is checked. sometimes you need to unchecked it, select a different API, apply settings, and then again select the API that was originally selected. Solution C Restart the eclipse Note :If none of the above solution work then find new one  and tell me  about the new solution in comments .thanks

Alert Dialog code snippets

    AlertDialog.Builder alert = new AlertDialog.Builder(AlarmActivity.this);         View view = LayoutInflater.from(getBaseContext()).inflate(                 R.layout.dialog_outofrange_values, null);         alert.setTitle(getString(R.string.invalid))                 .setIcon(android.R.drawable.ic_dialog_alert)                 .setMessage(getString(R.string.values_out_of_range))                 .setView(view).setNegativeButton(getString(R.string.ok), null)                 .show();

Adding fragment without UI

The fragment without UI can only be add within the activity programmatically. For this we have different variation of add method available.Use public abstract  FragmentTransaction  add ( Fragment  frag,  String  tag) frag:  fragment we want  to add in  activity tag: unique ID for identification usually the name of fragment. This method add the fragment in activity .As there is no UI so onCreateView () implementation is not required. Code snippet:             FragmentManager fragmentManager = getFragmentManager();             FragmentTransaction fragmentTransaction = fragmentManager                         .beginTransaction();          ...