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

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

源代码1 项目: bunk   文件: AttendanceActivity.java
private void setupDrawer() {
    DrawerLayout drawer = findViewById(R.id.drawer_layout);
    Toolbar toolbar = findViewById(R.id.toolbar);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();
    NavigationView navigationView = findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    View navigationViewHeader = navigationView.getHeaderView(0);
    ((TextView) navigationViewHeader.findViewById(R.id.name)).setText(this.newStudent.name);
    ((TextView) navigationViewHeader.findViewById(R.id.username)).setText(this.newStudent.username);
    String prompts[] = {"open source?", "coding?", "programming?", "code+coffee?"};
    TextView opensource = drawer.findViewById(R.id.opensource);
    opensource.setText(prompts[new Random().nextInt(prompts.length)]);
    TextView github = drawer.findViewById(R.id.github);
    github.setPaintFlags(Paint.UNDERLINE_TEXT_FLAG);
    github.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getResources().getString(R.string.github_url))));
        }
    });
}
 
源代码2 项目: xDrip   文件: AlertList.java
void FillLists() {
    // We use a - sign to tell that this text should be stiked through
    SimpleAdapter.ViewBinder vb = new SimpleAdapter.ViewBinder() {
        public boolean setViewValue(View view, Object data, String textRepresentation) {
            TextView tv = (TextView) view;
            tv.setText(textRepresentation.substring(1));
            if (textRepresentation.substring(0, 1).equals("-")) {
                tv.setPaintFlags(tv.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
            }
            return true;
        }
    };

    ArrayList<HashMap<String, String>> feedList;
    feedList = createAlertsMap(false);
    SimpleAdapter simpleAdapterLow = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent});
    simpleAdapterLow.setViewBinder(vb);

    listViewLow.setAdapter(simpleAdapterLow);

    feedList = createAlertsMap(true);
    SimpleAdapter simpleAdapterHigh = new SimpleAdapter(this, feedList, R.layout.row_alerts, new String[]{"alertName", "alertThreshold", "alertTime", "alertMp3File", "alertOverrideSilenceMode"}, new int[]{R.id.alertName, R.id.alertThreshold, R.id.alertTime, R.id.alertMp3File, R.id.alertOverrideSilent});
    simpleAdapterHigh.setViewBinder(vb);
    listViewHigh.setAdapter(simpleAdapterHigh);
}
 
源代码3 项目: NIM_Android_UIKit   文件: BaseViewHolder.java
/**
 * Apply the typeface to the given viewId, and enable subpixel rendering.
 */
public BaseViewHolder setTypeface(int viewId, Typeface typeface) {
    TextView view = getView(viewId);
    view.setTypeface(typeface);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    return this;
}
 
private void updateVisibilityFormat(ProductItem item)
{
    Resources resources = deleteProductItemCache.getProductCard().getContext().getResources();
    TextView productNameTextView = deleteProductItemCache.getProductNameTextView();
    TextView productQuantityTextView = deleteProductItemCache.getProductQuantityTextView();
    AppCompatCheckBox checkBox = (AppCompatCheckBox) deleteProductItemCache.getCheckBox();
    if ( item.isSelectedForDeletion() )
    {
        int transparent = resources.getColor(R.color.transparent);
        int grey = resources.getColor(R.color.middlegrey);

        deleteProductItemCache.getProductCard().setCardBackgroundColor(transparent);
        productNameTextView.setTextColor(grey);
        productQuantityTextView.setTextColor(grey);
        checkBox.setSupportButtonTintList(ColorStateList.valueOf(grey));
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
    }
    else
    {
        int white = resources.getColor(R.color.white);
        int black = resources.getColor(R.color.black);

        deleteProductItemCache.getProductCard().setCardBackgroundColor(white);
        productNameTextView.setTextColor(black);
        productQuantityTextView.setTextColor(black);
        checkBox.setSupportButtonTintList(ColorStateList.valueOf(black));
        productNameTextView.setPaintFlags(productNameTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
        productQuantityTextView.setPaintFlags(productQuantityTextView.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
}
 
源代码5 项目: SuntimesWidget   文件: EquinoxView.java
private void highlight( TextView view, boolean value )
{
    if (view != null)
    {
        if (value)
        {
            view.setTypeface(view.getTypeface(), Typeface.BOLD);
            view.setPaintFlags(view.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);

        } else {
            view.setTypeface(view.getTypeface(), Typeface.NORMAL);
            view.setPaintFlags(view.getPaintFlags() & (~Paint.UNDERLINE_TEXT_FLAG));
        }
    }
}
 
源代码6 项目: imsdk-android   文件: BaseViewHolder.java
/**
 * Apply the typeface to all the given viewIds, and enable subpixel rendering.
 */
public BaseViewHolder setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
源代码7 项目: SuntimesWidget   文件: LocationConfigView.java
private View listItemView(int position, View convertView, @NonNull ViewGroup parent)
{
    View view = convertView;
    if (view == null)
    {
        LayoutInflater inflater = LayoutInflater.from(context);
        view = inflater.inflate(R.layout.layout_listitem_locations, parent, false);
    }

    WidgetSettings.LocationMode item = modes.get(position);

    //ImageView icon = (ImageView) view.findViewById(android.R.id.icon1);
    //icon.setImageResource(item.getIcon());

    TextView text = (TextView) view.findViewById(android.R.id.text1);
    text.setText(item.getDisplayString());

    if (item == WidgetSettings.LocationMode.CURRENT_LOCATION && !autoAllowed)
    {
        text.setTypeface(text.getTypeface(), Typeface.ITALIC);
        text.setPaintFlags(text.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        text.setTextColor(text.getHintTextColors());
        view.setEnabled(false);
    }

    //TextView text2 = (TextView) view.findViewById(android.R.id.text2);
    //text2.setText(item.toString());

    return view;
}
 
/**
 * Apply the typeface to the given viewId, and enable subpixel rendering.
 */
public BaseAdapterHelper setTypeface(int viewId, Typeface typeface) {
    TextView view = retrieveView(viewId);
    view.setTypeface(typeface);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    return this;
}
 
源代码9 项目: demo4Fish   文件: BaseViewHolder.java
/**
 * Apply the typeface to the given viewId, and enable subpixel rendering.
 */
public BaseViewHolder setTypeface(int viewId, Typeface typeface) {
    TextView view = getView(viewId);
    view.setTypeface(typeface);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    return this;
}
 
源代码10 项目: PocketEOS-Android   文件: ViewHolder.java
public ViewHolder setTypeface(Typeface typeface, int... viewIds)
{
    for (int viewId : viewIds)
    {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
源代码11 项目: sms-ticket   文件: OpenSourceAdapter.java
private void openPlayServices(TextView textView) {
    textView.setPaintFlags(textView.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
    textView.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            PlayServicesLicenceDialogFragment.show(mFragmentManager);
        }
    });
}
 
源代码12 项目: LLApp   文件: RecyclerViewHolder.java
public RecyclerViewHolder setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
源代码13 项目: NightWatch   文件: Home.java
public void displayCurrentInfo() {
    final TextView currentBgValueText = (TextView) findViewById(R.id.currentBgValueRealTime);
    final TextView notificationText = (TextView) findViewById(R.id.notices);
    if ((currentBgValueText.getPaintFlags() & Paint.STRIKE_THRU_TEXT_FLAG) > 0) {
        currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() & (~Paint.STRIKE_THRU_TEXT_FLAG));
    }
    Bg lastBgreading = Bg.last();

    if (lastBgreading != null) {
        //TODO: Adrian: Remove raw string?
        notificationText.setText(lastBgreading.readingAge() + "\n" + Bg.threeRaw((prefs.getString("units", "mgdl").equals("mgdl"))));
        currentBgValueText.setText(bgGraphBuilder.unitized_string(lastBgreading.sgv_double()) + " " + lastBgreading.slopeArrow());
        if ((new Date().getTime()) - (60000 * 16) - lastBgreading.datetime > 0) {
            notificationText.setTextColor(Color.parseColor("#C30909"));
            currentBgValueText.setPaintFlags(currentBgValueText.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
        } else {
            notificationText.setTextColor(Color.WHITE);
        }
        double estimate = lastBgreading.sgv_double();
        if (bgGraphBuilder.unitized(estimate) <= bgGraphBuilder.lowMark) {
            currentBgValueText.setTextColor(Color.parseColor("#C30909"));
        } else if (bgGraphBuilder.unitized(estimate) >= bgGraphBuilder.highMark) {
            currentBgValueText.setTextColor(Color.parseColor("#FFBB33"));
        } else {
            currentBgValueText.setTextColor(Color.WHITE);
        }
    }
}
 
源代码14 项目: fangzhuishushenqi   文件: EasyRVHolder.java
@Override
public EasyRVHolder setTypeface(int viewId, Typeface typeface) {
    TextView view = getView(viewId);
    view.setTypeface(typeface);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    return this;
}
 
源代码15 项目: BigApp_Discuz_Android   文件: BaseAdapterHelper.java
/**
 * Apply the typeface to all the given viewIds, and enable subpixel
 * rendering.
 */
public BaseAdapterHelper setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = retrieveView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
public BaseRecyclerHolder setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
源代码17 项目: basic-adapter   文件: BaseViewHolder.java
/**
 * Apply the typeface to all the given viewIds, and enable subpixel rendering.
 */
public BaseViewHolder setTypeface(Typeface typeface, int... viewIds) {
    for (int viewId : viewIds) {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
源代码18 项目: baseAdapter   文件: ViewHolder.java
public ViewHolder setTypeface(Typeface typeface, int... viewIds)
{
    for (int viewId : viewIds)
    {
        TextView view = getView(viewId);
        view.setTypeface(typeface);
        view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
    return this;
}
 
private void updateViewGivenStatus(boolean isCompleted, TextView title, CheckBox status) {
       status.setChecked(isCompleted);
       if (isCompleted) {
           title.setPaintFlags(title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
       } else {
           title.setPaintFlags(title.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
       }
}
 
源代码20 项目: AndroidBase   文件: BaseAdapterHelper.java
/** Apply the typeface to the given viewId, and enable subpixel rendering. */
public BaseAdapterHelper setTypeface(int viewId, Typeface typeface) {
    TextView view = retrieveView(viewId);
    view.setTypeface(typeface);
    view.setPaintFlags(view.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    return this;
}
 
 方法所在类
 同类方法