To change TextSize by dynamically:
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 18);
(or)
textView.setTextSize(TypedValue.COMPLEX_UNIT_PX,getResources().
getDimension(R.dimen.textsize));
===================
How to add ttf(Font) file into an app for font?
Let we consider the font is a_FuturaOrtoRg Bold.ttf.
Step 1:
Create an Asset Folder in your project.And paste a_FuturaOrtoRg Bold.ttf into it.
Step 2:
Typeface tf = Typeface.createFromAsset(getApplicationContext().getAssets(), "a_FuturaOrtoRg Bold.ttf");
textview1.setTypeface(tf); // TextView textview1,textview2;
textview2.setTypeface(tf);
===================
For underlined Text:
textview.setPaintFlags(t2.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
==================
How to increase the spacing between lines in a textview.?
xml File:
android:lineSpacingExtra="xxdp" // xx greater than 1
Java Class:
textView.setLineSpacing(1.2);
http://stackoverflow.com/questions/11576002/how-to-increase-the-spacing-between-lines-in-a-textview
==================
How to use MARGINTOP by programmatically?
TextView tv = (TextView)findViewById(R.id.my_text_view);
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) textview.getLayoutParams();
params.setMargins(20, 0, 0, 0);
textview.setLayoutParams(params);
==================
How to change Password Hint in EditText?
inputPassword.setTypeface(Typeface.DEFAULT);
inputPassword.setTransformationMethod(new PasswordTransformationMethod());
=================
Comments
Post a Comment