Friday, 17 June 2016

Change android label color ,size and style

  
  Here I am going to explain how to change android label size,color and style


Step 1) Add Below code in your Activity

            Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
             toolbar.setTitleTextColor(Color.BLACK);
             toolbar.setTitleTextAppearance(this, R.style.MyActionBarTitleText);
             setSupportActionBar(toolbar);

Step 2)Add below code in your style.xml

      <style name="MyActionBarTitleText"
        parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textSize">24dp</item>
        <item name="android:textStyle">bold</item>
    </style>


Happy Coding :)

Sunday, 5 June 2016

AutoCompleteTextView Validation


  Here I am going to explain how to select from auto completion  Textview only.


clientName.setOnFocusChangeListener(new View.OnFocusChangeListener() {
            @Override
            public void onFocusChange(View view, boolean b) {
                if(!b) {
                
                    String str clientName.getText().toString();

                    ListAdapter listAdapter clientName.getAdapter();
                    for(int i = 0; i < listAdapter .getCount(); i++) {
                        String temp = listAdapter .getItem(i).toString();
                        if(str.compareTo(temp ) == 0) {
                            return;
                        }
                    }

                    clientName.setText("");

                }
            }
        });


Happy Coding :)