Java Code Examples for android.widget.TextView#setPadding()

The following examples show how to use android.widget.TextView#setPadding() . 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: DumpFragment.java    From Rabbits with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    ScrollView sv = new ScrollView(getActivity());
    sv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));

    TextView tv = new TextView(getActivity());
    tv.setText(Rabbit.dump());
    tv.setTextColor(0xFFA6ABB0);
    tv.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    int padding = (int) (getResources().getDisplayMetrics().density * 16);
    tv.setPadding(padding, padding, padding, padding);
    tv.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    sv.addView(tv);

    return sv;
}
 
Example 2
Source File: SimpleTableHeaderAdapter.java    From SortableTableView with Apache License 2.0 6 votes vote down vote up
@Override
public View getHeaderView(final int columnIndex, final ViewGroup parentView) {
    final TextView textView = new TextView(getContext());

    if (columnIndex < headers.length) {
        textView.setText(headers[columnIndex]);
        textView.setGravity(gravity);
    }

    textView.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    textView.setTypeface(textView.getTypeface(), typeface);
    textView.setTextSize(textSize);
    textView.setTextColor(textColor);
    textView.setSingleLine();
    textView.setEllipsize(TextUtils.TruncateAt.END);

    return textView;
}
 
Example 3
Source File: SlidingTabLayout.java    From SlideDayTimePicker with Apache License 2.0 6 votes vote down vote up
/**
 * Create a default view to be used for tabs. This is called if a custom tab view is not set via
 * {@link #setCustomTabView(int, int)}.
 */
protected TextView createDefaultTabView(Context context) {
    TextView textView = new TextView(context);
    textView.setGravity(Gravity.CENTER);
    textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
    textView.setTypeface(Typeface.DEFAULT_BOLD);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        // If we're running on Honeycomb or newer, then we can use the Theme's
        // selectableItemBackground to ensure that the View has a pressed state
        TypedValue outValue = new TypedValue();
        getContext().getTheme().resolveAttribute(android.R.attr.selectableItemBackground,
                outValue, true);
        textView.setBackgroundResource(outValue.resourceId);
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        // If we're running on ICS or newer, enable all-caps to match the Action Bar tab style
        textView.setAllCaps(true);
    }

    int padding = (int) (TAB_VIEW_PADDING_DIPS * getResources().getDisplayMetrics().density);
    textView.setPadding(padding, padding, padding, padding);

    return textView;
}
 
Example 4
Source File: SocialAuthDialog.java    From socialauth-android with MIT License 6 votes vote down vote up
/**
 * Sets title and icon of provider
 * 
 */

private void setUpTitle() {
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	mTitle = new TextView(getContext());
	int res = getContext().getResources().getIdentifier(mProviderName.toString(), "drawable",
			getContext().getPackageName());
	icon = getContext().getResources().getDrawable(res);
	StringBuilder sb = new StringBuilder();
	sb.append(mProviderName.toString().substring(0, 1).toUpperCase());
	sb.append(mProviderName.toString().substring(1, mProviderName.toString().length()));
	mTitle.setText(sb.toString());
	mTitle.setGravity(Gravity.CENTER_VERTICAL);
	mTitle.setTextColor(Color.WHITE);
	mTitle.setTypeface(Typeface.DEFAULT_BOLD);
	mTitle.setBackgroundColor(BLUE);
	mTitle.setPadding(MARGIN + PADDING, MARGIN, MARGIN, MARGIN);
	mTitle.setCompoundDrawablePadding(MARGIN + PADDING);
	mTitle.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);

	if (!titleStatus)
		mContent.addView(mTitle);
}
 
Example 5
Source File: ObservationListItemViewHolder.java    From ground-android with Apache License 2.0 6 votes vote down vote up
@NonNull
private TextView newFieldTextView(String text, int textAppearance) {
  Context context = binding.getRoot().getContext();
  Resources resources = context.getResources();
  TextView v = new TextView(context);
  v.setTextAppearance(context, textAppearance);
  // NOTE: These attributes don't work when applying text appearance programmatically, so we set
  // them here individually instead.
  v.setPadding(
      0, 0, resources.getDimensionPixelSize(R.dimen.observation_summary_text_padding_right), 0);
  v.setMaxWidth(resources.getDimensionPixelSize(R.dimen.observation_summary_text_max_width));
  v.setMaxLines(1);
  v.setSingleLine();
  v.setEllipsize(TextUtils.TruncateAt.END);
  v.setText(text);
  return v;
}
 
Example 6
Source File: FloatLabelLayout.java    From Android-PreferencesManager with Apache License 2.0 6 votes vote down vote up
public FloatLabelLayout(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);

    final TypedArray a = context
            .obtainStyledAttributes(attrs, R.styleable.FloatLabelLayout);

    final int sidePadding = a.getDimensionPixelSize(
            R.styleable.FloatLabelLayout_floatLabelSidePadding,
            dipsToPix(DEFAULT_PADDING_LEFT_RIGHT_DP));
    mLabel = new TextView(context);
    mLabel.setPadding(sidePadding, 0, sidePadding, 0);
    mLabel.setVisibility(INVISIBLE);

    mLabel.setTextAppearance(context,
            a.getResourceId(R.styleable.FloatLabelLayout_floatLabelTextAppearance,
                    android.R.style.TextAppearance_Small)
    );

    addView(mLabel, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    a.recycle();
}
 
Example 7
Source File: ButtonMappingDialogPreference.java    From crazyflie-android-client with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected View onCreateDialogView() {
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    LinearLayout layout = new LinearLayout(getContext());
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setPadding(6,6,6,6);

    TextView promptTextView = new TextView(getContext());
    promptTextView.setText(R.string.preferences_button_mapping_dialog_text);
    promptTextView.setGravity(Gravity.CENTER_HORIZONTAL);

    mValueTextView = new TextView(getContext());
    mValueTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22);
    mValueTextView.setGravity(Gravity.CENTER_HORIZONTAL);
    mValueTextView.setPadding(0, 12, 0, 12);

    layout.addView(promptTextView, params);
    layout.addView(mValueTextView, params);

    return layout;
}
 
Example 8
Source File: ChatActivity.java    From talk-android with MIT License 6 votes vote down vote up
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder viewHolder;
    if (convertView == null) {
        viewHolder = new ViewHolder();
        TextView textView = new TextView(parent.getContext());
        final int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 48, parent.getResources().getDisplayMetrics());
        textView.setLayoutParams(new AbsListView.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, height));
        textView.setGravity(Gravity.CENTER_VERTICAL);
        textView.setEllipsize(TextUtils.TruncateAt.MIDDLE);
        textView.setSingleLine();
        textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);
        final int padding = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 24, parent.getResources().getDisplayMetrics());
        textView.setPadding(padding, 0, padding, 0);
        convertView = textView;
        viewHolder.textView = (TextView) convertView;
        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolder) convertView.getTag();
    }
    viewHolder.textView.setText(items[position]);
    return convertView;
}
 
Example 9
Source File: BlogDateAdapter.java    From LoveTalkClient with Apache License 2.0 6 votes vote down vote up
TextView getTextView() {
	//设置TextView的样式
	AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
			ViewGroup.LayoutParams.WRAP_CONTENT, 64);
	TextView textView = new TextView(
			mContext);
	textView.setLayoutParams(lp);
	textView.setGravity(Gravity.CENTER_VERTICAL);
	//设置TextView的Padding值
	textView.setPadding(16, -10, 0, 32);
	//设置TextView的字体大小
	textView.setTextSize(14);
	//设置TextView的字体颜色
	textView.setTextColor(Color.WHITE);
	//设置字体加粗
	TextPaint txt = textView.getPaint();
	txt.setFakeBoldText(true);
	return textView;
}
 
Example 10
Source File: MatrixTableAdapter.java    From android_maplibui with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void setPadding(Context context, TextView view) {
	int padding = ControlHelper.dpToPx(2, context.getResources());
	view.setPadding(padding, padding, padding, padding);
	view.setGravity(Gravity.CENTER_VERTICAL);
	if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
		view.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
	}
}
 
Example 11
Source File: UIActionSheetDialog.java    From UIWidget with Apache License 2.0 5 votes vote down vote up
/**
 * 创建Title
 */
private void createTitle() {
    if (TextUtils.isEmpty(mTitleStr)) {
        return;
    }
    mTvTitle = new TextView(mContext);
    mTvTitle.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    mTvTitle.setMinimumHeight(dp2px(20));
    mTvTitle.setId(R.id.tv_titleActionSheetDialog);
    mLLayoutRoot.addView(mTvTitle);

    Drawable background = mStateDrawableSingle;
    mTvTitle.setLineSpacing(mLineSpacingExtra, mLineSpacingMultiplier);
    mTvTitle.setGravity(mTitleGravity);
    mTvTitle.setPadding(mItemsTextPaddingLeft, mItemsTextPaddingTop, mItemsTextPaddingRight, mItemsTextPaddingBottom);
    mTvTitle.setCompoundDrawablePadding(mTextDrawablePadding);
    mTvTitle.setText(mTitleStr);
    mTvTitle.setTextSize(mTextSizeUnit, mTitleTextSize);
    mTvTitle.setTextColor(mTitleTextColor);
    boolean hasList = mListItem != null && mListItem.size() > 0;
    boolean hasCancel = !TextUtils.isEmpty(mCancelStr) && mCancelMarginTop <= 0;
    if (hasList || hasCancel) {
        background = mStateDrawableTop.getCurrent();
    }
    setViewBackground(mTvTitle, DrawableUtil.getNewDrawable(background));
    setTextViewLine(mTvTitle);
}
 
Example 12
Source File: CustomLabelTextView.java    From douyin with Apache License 2.0 5 votes vote down vote up
private void init(){
    this.setOrientation(HORIZONTAL);
    this.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, dp2px(28)));
    this.setPadding(dp2px(10), 0, 0, 0);
    LayoutParams tv_params = new LayoutParams(LayoutParams.WRAP_CONTENT, dp2px(24));

    TextView tv_left = new TextView(mContext);
    tv_left.setText(leftText);
    tv_left.setTextColor(Color.WHITE);
    tv_left.setClickable(true);
    tv_left.setPadding(dp2px(10), dp2px(2), dp2px(10), dp2px(2));
    GradientDrawable drawable1 = ViewUtil.createGradientDrawableRadius(2, new float[]{14, 14, 0, 0, 0, 0, 14, 14}, colorLeft);
    drawable1.setColor(ViewUtil.createColorStateList(
            Color.parseColor("#58575c"),
            Color.parseColor("#ae58575c"),
            Color.parseColor("#58575c"),
            Color.parseColor("#a158575c")));
    tv_left.setBackground(drawable1);
    tv_left.setLayoutParams(tv_params);

    TextView tv_right = new TextView(mContext);
    tv_right.setText(rightText);
    tv_right.setTextColor(Color.WHITE);
    tv_right.setClickable(true);
    tv_right.setPadding(dp2px(10), dp2px(2), dp2px(10), dp2px(2));
    GradientDrawable drawable2 = ViewUtil.createGradientDrawableRadius(2, new float[]{0, 0, 14, 14, 14, 14, 0, 0}, colorRight);
    drawable2.setColor(ViewUtil.createColorStateList(
            colorRight,
            Color.parseColor("#aa"+colorRightString.substring(1)),
            colorRight,
            colorRight));
    tv_right.setBackground(drawable2);
    tv_right.setLayoutParams(tv_params);

    this.addView(tv_left);
    this.addView(tv_right);
}
 
Example 13
Source File: BackupKeyActivity.java    From alpha-wallet-android with MIT License 5 votes vote down vote up
private TextView generateSeedWordTextView(String word) {
    int margin = Utils.dp2px(this, 4);
    int padding;
    float textSize;
    int textViewHeight;

    if (screenWidth > 800) {
        textSize = 16.0f;
        padding = Utils.dp2px(this, 20);
        textViewHeight = Utils.dp2px(this, 44);
    } else {
        textSize = 14.0f;
        padding = Utils.dp2px(this, 16);
        textViewHeight = Utils.dp2px(this, 38);
    }

    FlexboxLayout.LayoutParams params =
            new FlexboxLayout.LayoutParams(FlexboxLayout.LayoutParams.WRAP_CONTENT, textViewHeight);

    params.setMargins(margin, margin, margin, margin);
    TextView seedWord = new TextView(this);
    seedWord.setMaxLines(1);
    seedWord.setText(word);
    seedWord.setTypeface(ResourcesCompat.getFont(this, R.font.font_regular));
    seedWord.setTextSize(TypedValue.COMPLEX_UNIT_SP, textSize);
    seedWord.setBackgroundResource(R.drawable.background_seed_word);
    seedWord.setTextColor(getColor(R.color.mine));
    seedWord.setLayoutParams(params);
    seedWord.setGravity(Gravity.CENTER);
    seedWord.setPadding(padding, 0, padding, 0);

    return seedWord;
}
 
Example 14
Source File: ExpandableList1.java    From codeexamples-android with Eclipse Public License 1.0 5 votes vote down vote up
public TextView getGenericView() {
    // Layout parameters for the ExpandableListView
    AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT, 64);

    TextView textView = new TextView(ExpandableList1.this);
    textView.setLayoutParams(lp);
    // Center the text vertically
    textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
    // Set the text starting position
    textView.setPadding(36, 0, 0, 0);
    return textView;
}
 
Example 15
Source File: MainActivity.java    From android-orm-benchmark-updated with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    final TextView resultView = new TextView(getActivity());
    final int paddingDp = 10;
    final int paddingPx = dpToPx(paddingDp);
    resultView.setPadding(paddingPx, paddingPx, paddingPx, paddingPx);
    resultView.setText(Html.fromHtml(getArguments().getString(MESSAGE)));
    resultView.setTextIsSelectable(true);
    AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
    return builder.setTitle(getArguments().getInt(TITLE_RES_ID))
            .setView(resultView)
            .create();
}
 
Example 16
Source File: Marker.java    From UltimateAndroid with Apache License 2.0 4 votes vote down vote up
public Marker(Context context, AttributeSet attrs, int defStyleAttr, String maxValue) {
    super(context, attrs, defStyleAttr);
    DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
    TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.DiscreteSeekBar,
            R.attr.discreteSeekBarStyle, R.style.DefaultSeekBar);

    int padding = (int) (PADDING_DP * displayMetrics.density) * 2;
    int textAppearanceId = a.getResourceId(R.styleable.DiscreteSeekBar_dsb_indicatorTextAppearance,
            R.style.DefaultIndicatorTextAppearance);
    mNumber = new TextView(context);
    //Add some padding to this textView so the bubble has some space to breath
    mNumber.setPadding(padding, 0, padding, 0);
    mNumber.setTextAppearance(context, textAppearanceId);
    mNumber.setGravity(Gravity.CENTER);
    mNumber.setText(maxValue);
    mNumber.setMaxLines(1);
    mNumber.setSingleLine(true);
    SeekBarCompat.setTextDirection(mNumber, TEXT_DIRECTION_LOCALE);
    mNumber.setVisibility(View.INVISIBLE);

    //add some padding for the elevation shadow not to be clipped
    //I'm sure there are better ways of doing this...
    setPadding(padding, padding, padding, padding);

    resetSizes(maxValue);

    mSeparation = (int) (SEPARATION_DP * displayMetrics.density);
    int thumbSize = (int) (ThumbDrawable.DEFAULT_SIZE_DP * displayMetrics.density);
    ColorStateList color = a.getColorStateList(R.styleable.DiscreteSeekBar_dsb_indicatorColor);
    mMarkerDrawable = new MarkerDrawable(color, thumbSize);
    mMarkerDrawable.setCallback(this);
    mMarkerDrawable.setMarkerListener(this);
    mMarkerDrawable.setExternalOffset(padding);

    //Elevation for anroid 5+
    float elevation = a.getDimension(R.styleable.DiscreteSeekBar_dsb_indicatorElevation, ELEVATION_DP * displayMetrics.density);
    ViewCompat.setElevation(this, elevation);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        SeekBarCompat.setOutlineProvider(this, mMarkerDrawable);
    }
    a.recycle();
}
 
Example 17
Source File: ToastUtils.java    From ToastUtils with Apache License 2.0 4 votes vote down vote up
/**
 * 生成默认的 TextView 对象
 */
private static TextView createTextView(Context context, IToastStyle style) {

    GradientDrawable drawable = new GradientDrawable();
    // 设置背景色
    drawable.setColor(style.getBackgroundColor());
    // 设置圆角大小
    drawable.setCornerRadius(style.getCornerRadius());

    TextView textView = new TextView(context);
    textView.setId(android.R.id.message);
    textView.setTextColor(style.getTextColor());
    textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, style.getTextSize());

    // 适配布局反方向
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        textView.setPaddingRelative(style.getPaddingStart(), style.getPaddingTop(), style.getPaddingEnd(), style.getPaddingBottom());
    } else {
        textView.setPadding(style.getPaddingStart(), style.getPaddingTop(), style.getPaddingEnd(), style.getPaddingBottom());
    }

    textView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    // setBackground API 版本兼容
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        textView.setBackground(drawable);
    } else {
        textView.setBackgroundDrawable(drawable);
    }

    // 设置 Z 轴阴影
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        textView.setZ(style.getZ());
    }

    // 设置最大显示行数
    if (style.getMaxLines() > 0) {
        textView.setMaxLines(style.getMaxLines());
    }

    return textView;
}
 
Example 18
Source File: ActivityChooseRootEvent.java    From LibreTasks with Apache License 2.0 4 votes vote down vote up
/**
 * This function will be called once for every element in the listView control, when it needs to
 * draw itself. It should return a constructed view representing the data in the position
 * specified. Each element in the listView is an Event item, so we display the Event's icon and
 * title.
 * 
 * TODO: Use convertView when possible instead of always creating new views.
 */
public View getView(int position, View convertView, ViewGroup parent) {
  LinearLayout ll = new LinearLayout(context);
  ll.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.FILL_PARENT,
      LayoutParams.FILL_PARENT));
  ll.setMinimumHeight(50);
  ll.setOrientation(LinearLayout.HORIZONTAL);
  ll.setGravity(Gravity.CENTER_VERTICAL);

  // Icon of the event.
  ImageView iv = new ImageView(context);
  iv.setImageResource(events.get(position).getIconResId());
  iv.setAdjustViewBounds(true);
  iv.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT,
      LayoutParams.WRAP_CONTENT));
  if (listView.getCheckedItemPosition() == position) {
    iv.setBackgroundResource(R.drawable.icon_hilight);
  }

  // Title of the event.
  TextView tv = new TextView(context);
  String text = events.get(position).getDescriptionShort();

  int numOfRules = UIDbHelperStore.instance().db().getRuleCount(
      events.get(position).getDatabaseId());
  if (numOfRules == 1) {
    text += getString(R.string.one_rule);
  } else if (numOfRules > 1) {
    text += getString(R.string.n_rules, numOfRules);
  }

  tv.setText(text);
  tv.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.FILL_PARENT,
      LayoutParams.FILL_PARENT));
  tv.setGravity(Gravity.CENTER_VERTICAL);
  tv.setPadding(10, 0, 0, 0);
  tv.setTextSize(14.0f);
  tv.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
  tv.setTextColor(context.getResources().getColor(R.color.list_element_text));
  tv.setMinHeight(46);

  ll.addView(iv);
  ll.addView(tv);

  return ll;
}
 
Example 19
Source File: RichActionView.java    From imsdk-android with MIT License 4 votes vote down vote up
public void bindData(final RichText text)
{
    if(container.getChildCount()>6) container.removeViewAt(container.getChildCount()-1);
    if(TextUtils.isEmpty(text.introduce)) {
        introduce.setText(Html.fromHtml(text.content));
        TextView textView = new TextView(context);
        textView.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT));
        textView.setText("点击查看更多");
        textView.setGravity(Gravity.RIGHT);
        textView.setTextColor(ContextCompat.getColor(context,R.color.atom_ui_button_primary_color));
        textView.setPadding(Utils.dipToPixels(context,16),Utils.dipToPixels(context,8),
                Utils.dipToPixels(context,16), Utils.dipToPixels(context,8));

        container.addView(textView);
    }
    else {
        introduce.setText(Html.fromHtml(text.introduce));
    }

    title.setText(text.title);
    if(TextUtils.isEmpty(text.date))
    {
        date.setVisibility(GONE);
    }
    else {
        date.setVisibility(VISIBLE);
        date.setText(text.date);
    }
    if(!TextUtils.isEmpty(text.imageurl)) {
        FacebookImageUtil.loadWithCache(text.imageurl, image_rich,
                false, new FacebookImageUtil.ImageLoadCallback.EmptyCallback());
    }
    this.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(context, QunarWebActvity.class);
            intent.setData(Uri.parse(text.linkurl));
            context.startActivity(intent);
        }
    });
}
 
Example 20
Source File: CertificateViewer.java    From android-chromium with BSD 2-Clause "Simplified" License 4 votes vote down vote up
private void addValue(LinearLayout certificateView, String value) {
    TextView t = new TextView(mContext);
    t.setText(value);
    t.setPadding(mPadding, 0, mPadding, mPadding / 2);
    certificateView.addView(t);
}