Search code examples
androidtextviewfont-sizetext-size

Increasing and Decreasing the font sizes of the android application by user selection


Actually i want to specify the custom text size in my application by user selection. Below is a figure that demonstrate the idea/theme

enter image description here

So, for that i have an idea to achieve this.

I will create a dialog in the view which having the user input options to increase/ decrease the font size. after changing the font size, i vll apply the same to the application. (+) & (-) signs will work to change the font size as well as seek bar too.

Here my question is is there any specific font style/ size changes in build android class / library / any other idea is available?

any help will be appreciate. mean while i will come with something which i try. Thankyou


Solution

  • you can check

    btnTextDeSave.setOnClickListener(onClickEven);
    btnTextInSave.setOnClickListener(onClickEven);
    
    public OnClickListener onClickEven = new OnClickListener() {
    
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            switch (v.getId()) {
                break;
            case R.id.btTextDeSave:
                txtDescriptionSave.setTextSize(TypedValue.COMPLEX_UNIT_PX, (txtDescriptionSave.getTextSize() - 2f));
                break;
            case R.id.btTextInSave:
                txtDescriptionSave.setTextSize(TypedValue.COMPLEX_UNIT_PX, (txtDescriptionSave.getTextSize() + 2f));
                break;
    
            default:
                break;
            }
    
        }
    };