Java Code Examples for android.widget.EditText#setLineSpacing()

The following examples show how to use android.widget.EditText#setLineSpacing() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HyperTextEditor.java    From YCCustomText with Apache License 2.0 6 votes vote down vote up
/**
 * 添加生成文本输入框
 * @param hint								内容
 * @param paddingTop						到顶部高度
 * @return
 */
private EditText createEditText(String hint, int paddingTop) {
	EditText editText = new DeletableEditText(getContext());
	LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	editText.setLayoutParams(layoutParams);
	editText.setTextSize(16);
	editText.setTextColor(Color.parseColor("#616161"));
	editText.setCursorVisible(true);
	editText.setBackground(null);
	editText.setOnKeyListener(keyListener);
	editText.setOnFocusChangeListener(focusListener);
	editText.addTextChangedListener(textWatcher);
	editText.setTag(viewTagIndex++);
	editText.setPadding(editNormalPadding, paddingTop, editNormalPadding, paddingTop);
	editText.setHint(hint);
	editText.setTextSize(TypedValue.COMPLEX_UNIT_PX, rtTextSize);
	editText.setTextColor(rtTextColor);
	editText.setHintTextColor(rtHintTextColor);
	editText.setLineSpacing(rtTextLineSpace, 1.0f);
	HyperLibUtils.setCursorDrawableColor(editText, cursorColor);
	return editText;
}
 
Example 2
Source File: EditFragment.java    From pandora with Apache License 2.0 4 votes vote down vote up
@Override
protected View getLayoutView() {
    View wrapper;
    editText = new EditText(getContext());
    int padding = ViewKnife.dip2px(16);
    editText.setPadding(padding, padding, padding, padding);
    editText.setBackgroundColor(Color.WHITE);
    editText.setGravity(Gravity.START | Gravity.TOP);
    editText.setTextColor(ViewKnife.getColor(R.color.pd_label_dark));
    editText.setLineSpacing(0, 1.2f);

    String[] options = getArguments().getStringArray(PARAM3);
    if (options != null && options.length > 0) {
        LinearLayout layout = new LinearLayout(getContext());
        layout.setOrientation(LinearLayout.VERTICAL);
        wrapper = layout;
        RecyclerView recyclerView = new RecyclerView(getContext());
        recyclerView.setBackgroundColor(Color.WHITE);
        LinearLayoutManager manager = new LinearLayoutManager(getContext());
        manager.setOrientation(LinearLayoutManager.HORIZONTAL);
        recyclerView.setLayoutManager(manager);
        UniversalAdapter adapter = new UniversalAdapter();
        recyclerView.setAdapter(adapter);
        adapter.setListener(new UniversalAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(int position, BaseItem item) {
                notifyResult(((OptionItem)item).data);
            }
        });
        List<BaseItem> items = new ArrayList<>(options.length);
        for (String option : options) {
            items.add(new OptionItem(option));
        }
        adapter.setItems(items);

        LinearLayout.LayoutParams recyclerParam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewKnife.dip2px(50)
        );
        layout.addView(recyclerView, recyclerParam);
        LinearLayout.LayoutParams editParam = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT
        );
        layout.addView(editText, editParam);
    } else {
        wrapper = editText;
    }
    return wrapper;
}