Java Code Examples for android.widget.TextView.setMinHeight()

The following are Jave code examples for showing how to use setMinHeight() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: CCDownload   File: AccountViewAdapter.java   View Source Code Vote up 5 votes
private View getItemView(Pair<String, String> pair){
	RelativeLayout accountView = new RelativeLayout(context);
	TextView textView = new TextView(context);
	textView.setText(pair.first + " : " + pair.second);
	textView.setTextSize(16);
	textView.setPadding(10, 30, 0, 0);
	textView.setMinHeight(ParamsUtil.dpToPx(context, 48));
	LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	params.addRule(RelativeLayout.CENTER_VERTICAL);
	
	accountView.addView(textView, params);
	return accountView;
	
}
 
Example 2
Project: MyCalendar   File: MainActivity.java   View Source Code Vote up 5 votes
private TextView createTextView(Context context, String s, int minHeight, int marginTop, int marginBottom, int marginLeftRight) {
    TextView tv = new TextView(context);
    LinearLayout.LayoutParams params =
            new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.setMargins(marginLeftRight, marginTop, marginLeftRight, marginBottom);
    tv.setLayoutParams(params);
    tv.setText(s);
    tv.setGravity(Gravity.CENTER);
    tv.setMinHeight(minHeight);
    tv.setTextAppearance(mContext, R.style.TextAppearance_AppCompat_Caption);
    return tv;

}