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

The following are Jave code examples for showing how to use setMaxEms() 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: CXJPadProject   File: DishesView.java   View Source Code Vote up 6 votes
private View getcontentTextView() {

        countText=new TextView(getContext());

        countText.setSingleLine(true);
        countText.setGravity(Gravity.CENTER);
        countText.setMaxEms(8);
        countText.setTextSize(20);
        countText.setFocusable(false);
        LayoutParams param=getLayoutParams((getMeasuredWidth()-20)/4,getMeasuredHeight()+80);
        param.weight=3;
        param.gravity= Gravity.CENTER;
        countText.setLayoutParams(param);

        setBackgroundDrawable(countText, editTextDrawable);
//        onUpdateEditText();
        onUpdatecountText();

        return countText;
    }
 
Example 2
Project: AliZhiBoHao   File: LiveCameraActivity.java   View Source Code Vote up 6 votes
public void addView(TextView childView, String text) {
    if (push_state_ll.getChildCount() > 3) {
        push_state_ll.removeViewAt(0);
    }
    LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    layoutParams.setMargins(0, 0, 0, 10);
    childView.setTextColor(Color.RED);
    childView.setText(text);
    childView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 13f);
    childView.setBackgroundResource(R.drawable.text_state);
    childView.setLayoutParams(layoutParams);
    childView.setPadding(15, 10, 15, 10);
    childView.setMaxEms(20);
    childView.setMaxLines(3);
    push_state_ll.addView(childView);
}
 
Example 3
Project: android-study   File: CommonUtils.java   View Source Code Vote up 4 votes
/**
 * 把标题字体加粗、颜色白色
 *
 * @param titleView TextView
 */
public static void updateTitleText(TextView titleView) {
  titleView.setTextColor(Color.WHITE);
  titleView.getPaint().setFakeBoldText(true);
  titleView.setMaxEms(10);
}