android.widget.TextView#setMinLines ( )源码实例Demo

下面列出了android.widget.TextView#setMinLines ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: xposed-rimet   文件: PluginSettingsAdapter.java
public View onCreateView(LayoutInflater layoutInflater, ViewGroup parent, int viewType) {

        CommentItemView commentItemView = new CommentItemView(getContext());
        TextView textView = commentItemView.getContentView();
        textView.setTextSize(16);
        textView.setMinLines(1);
        textView.setMaxLines(1);
        textView.setHeight(DisplayUtil.dip2px(getContext(), 32));

        return commentItemView;
    }
 
源代码2 项目: openScale   文件: TableFragment.java
@Override
public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    LinearLayout row = new LinearLayout(getContext());
    row.setLayoutParams(new LinearLayout.LayoutParams(
            LinearLayout.LayoutParams.MATCH_PARENT,
            LinearLayout.LayoutParams.WRAP_CONTENT));

    final int screenSize = getResources().getConfiguration()
            .screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK;
    final boolean isSmallScreen =
            screenSize != Configuration.SCREENLAYOUT_SIZE_XLARGE
                    && screenSize != Configuration.SCREENLAYOUT_SIZE_LARGE;

    final int count = viewType == VIEW_TYPE_YEAR ? 1 : visibleMeasurements.size();
    for (int i = 0; i < count; ++i) {
        TextView column = new TextView(getContext());
        column.setLayoutParams(new LinearLayout.LayoutParams(
                0, ViewGroup.LayoutParams.WRAP_CONTENT, 1));

        if (viewType == VIEW_TYPE_MEASUREMENT) {
            column.setMinLines(2);
            column.setGravity(Gravity.CENTER_HORIZONTAL);

            if (isSmallScreen) {
                column.setTextSize(COMPLEX_UNIT_DIP, 9);
            }
        }
        else {
            column.setPadding(0, 10, 0, 10);
            column.setGravity(Gravity.CENTER);
            column.setTextSize(COMPLEX_UNIT_DIP, 16);
        }

        row.addView(column);
    }

    return new ViewHolder(row);
}
 
 方法所在类
 同类方法