当前位置: 首页>>代码示例>>Java>>正文


Java RelativeSizeSpan类代码示例

本文整理汇总了Java中android.text.style.RelativeSizeSpan的典型用法代码示例。如果您正苦于以下问题:Java RelativeSizeSpan类的具体用法?Java RelativeSizeSpan怎么用?Java RelativeSizeSpan使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RelativeSizeSpan类属于android.text.style包,在下文中一共展示了RelativeSizeSpan类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeResources

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
private void initializeResources() {
  getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
  getSupportActionBar().setCustomView(R.layout.centered_app_title);

  ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);

  showButton       = (ImageButton)     findViewById(R.id.passphrase_visibility);
  hideButton       = (ImageButton)     findViewById(R.id.passphrase_visibility_off);
  visibilityToggle = (AnimatingToggle) findViewById(R.id.button_toggle);
  passphraseText   = (EditText)        findViewById(R.id.passphrase_edit);
  SpannableString hint = new SpannableString("  " + getString(R.string.PassphrasePromptActivity_enter_passphrase));
  hint.setSpan(new RelativeSizeSpan(0.9f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
  hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);

  passphraseText.setHint(hint);
  okButton.setOnClickListener(new OkButtonClickListener());
  showButton.setOnClickListener(new ShowButtonOnClickListener());
  hideButton.setOnClickListener(new HideButtonOnClickListener());
  passphraseText.setOnEditorActionListener(new PassphraseActionListener());
  passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
                                   EditorInfo.IME_ACTION_DONE);
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:23,代码来源:PassphrasePromptActivity.java

示例2: getViewAt

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
@Override
public RemoteViews getViewAt(int position) {
    ScheduleDailyGroupModel model = list.get(position);
    RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.layout_schedule_daily_widget);

    remoteViews.setTextViewText(R.id.title_schedule_daily, model.day);

    CharSequence builder = null;
    for (ScheduleDailyModel e : model.scheduleDailyModels()) {
        String course = e.desc.substring(0, e.desc.indexOf(" Ruang: "));
        String room = e.desc.substring(e.desc.indexOf(" Ruang: ") + 8);
        SpannableString title = new SpannableString(course);
        title.setSpan(new RelativeSizeSpan(1.2f), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        SpannableString time = new SpannableString("R. " + room + "\t\t" + e.time);
        time.setSpan(new ForegroundColorSpan(context.getResources().getColor(android.R.color.darker_gray)), 0, time.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        if (builder == null) {
            builder = TextUtils.concat(title, "\n", time + "\n\n");
        } else {
            builder = TextUtils.concat(builder, title, "\n", time + "\n\n");
        }
    }
    remoteViews.setTextViewText(R.id.content_schedule_daily, builder == null ? "(empty)\n\n" : builder);

    return remoteViews;
}
 
开发者ID:mgilangjanuar,项目名称:GoSCELE,代码行数:26,代码来源:ScheduleDailyProvider.java

示例3: setHint

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
public void setHint(@NonNull String hint, @Nullable CharSequence subHint) {
  this.hint = new SpannableString(hint);
  this.hint.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);

  if (subHint != null) {
    this.subHint = new SpannableString(subHint);
    this.subHint.setSpan(new RelativeSizeSpan(0.8f), 0, subHint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
  } else {
    this.subHint = null;
  }

  if (this.subHint != null) {
    super.setHint(new SpannableStringBuilder().append(ellipsizeToWidth(this.hint))
                                              .append("\n")
                                              .append(ellipsizeToWidth(this.subHint)));
  } else {
    super.setHint(ellipsizeToWidth(this.hint));
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:20,代码来源:ComposeText.java

示例4: onBindViewHolder

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
@Override
public void onBindViewHolder(BucketViewHolder holder, int position) {
    BucketBean bucketBean = mBucketList.get(position);
    String bucketName = bucketBean.getBucketName();
    if (position != 0) {
        SpannableString nameSpannable = new SpannableString(bucketName + "\n" + bucketBean.getImageCount() + "张");
        nameSpannable.setSpan(new ForegroundColorSpan(Color.GRAY), bucketName.length(), nameSpannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        nameSpannable.setSpan(new RelativeSizeSpan(0.8f), bucketName.length(), nameSpannable.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        holder.mTvBucketName.setText(nameSpannable);
    } else {
        holder.mTvBucketName.setText(bucketName);
    }
    if (mSelectedBucket != null && TextUtils.equals(mSelectedBucket.getBucketId(), bucketBean.getBucketId())) {
        holder.mRbSelected.setVisibility(View.VISIBLE);
        holder.mRbSelected.setChecked(true);
    } else {
        holder.mRbSelected.setVisibility(View.GONE);
    }

    String path = bucketBean.getCover();
    mConfiguration.getImageLoader()
            .displayImage(holder.itemView.getContext(), path, holder.mIvBucketCover, mDefaultImage, mConfiguration.getImageConfig(),
                    true, mConfiguration.isPlayGif(), 100, 100, bucketBean.getOrientation());
}
 
开发者ID:Loofer,项目名称:Watermark,代码行数:25,代码来源:BucketAdapter.java

示例5: handleMessage

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
@Override
public void handleMessage(Message msg) {
    super.handleMessage(msg);
    switch (msg.what) {
        case 0x001:
            SpannableString string = new SpannableString("设置文字的前景色为淡蓝色");
            RelativeSizeSpan sizeSpan = new RelativeSizeSpan(1.5f);
            string.setSpan(sizeSpan, pos, pos + 1, Spanned.SPAN_EXCLUSIVE_INCLUSIVE);
            bgtext.setText(string);
            pos++;
            if (pos >= bgtext.getText().length()) {
                pos = 0;
            }
            Message ms = Message.obtain();
            ms.what = 0x001;
            handler.sendEmptyMessageDelayed(0x001, 150);
            break;
    }
}
 
开发者ID:wuhighway,项目名称:DailyStudy,代码行数:20,代码来源:SpannableStringActivity.java

示例6: spannerbleTitleForHeaderInSection

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
public SpannableStringBuilder spannerbleTitleForHeaderInSection(
        ATableView tableView, int section) {
    HH2SectionData sd = data.get(section);
    String text = sd.getHeader();
    SpannableStringBuilder builder = new SpannableStringBuilder(text);
    builder.setSpan(new ForegroundColorSpan(Color.BLUE), 0,
            text.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    if (text.contains("$")) {
        int index = text.indexOf("$") + 1;
        builder.setSpan(new ForegroundColorSpan(Color.RED), index,
                text.length(),
                SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.setSpan(new RelativeSizeSpan(0.55f), index,
                text.length(),
                SpannableStringBuilder.SPAN_EXCLUSIVE_EXCLUSIVE);
        builder.replace(index - 1, index, "\n");
    }

    return builder;
}
 
开发者ID:hh-in-zhuzhou,项目名称:ShangHanLun,代码行数:21,代码来源:ShowFragment.java

示例7: endCssStyle

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
private void endCssStyle(String tag, Editable text) {
    Strikethrough s = getLast(text, Strikethrough.class);
    if (s != null) {
        setSpanFromMark(tag, text, s, new StrikethroughSpan());
    }
    Background b = getLast(text, Background.class);
    if (b != null) {
        setSpanFromMark(tag, text, b, new BackgroundColorSpan(b.mBackgroundColor));
    }
    Foreground f = getLast(text, Foreground.class);
    if (f != null) {
        setSpanFromMark(tag, text, f, new ForegroundColorSpan(f.mForegroundColor));
    }
    AbsoluteSize a = getLast(text, AbsoluteSize.class);
    if (a != null) {
        setSpanFromMark(tag, text, a, new AbsoluteSizeSpan(a.getTextSize()));
    }
    RelativeSize r = getLast(text, RelativeSize.class);
    if (r != null) {
        setSpanFromMark(tag, text, r, new RelativeSizeSpan(r.getTextProportion()));
    }
}
 
开发者ID:Pixplicity,项目名称:HtmlCompat,代码行数:23,代码来源:HtmlToSpannedConverter.java

示例8: setHint

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
public void setHint(@NonNull String hint, @Nullable CharSequence subHint) {
  this.hint = hint;

  if (subHint != null) {
    this.subHint = new SpannableString(subHint);
    this.subHint.setSpan(new RelativeSizeSpan(0.5f), 0, subHint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
  } else {
    this.subHint = null;
  }

  if (this.subHint != null) {
    super.setHint(new SpannableStringBuilder().append(ellipsizeToWidth(this.hint))
                                              .append("\n")
                                              .append(ellipsizeToWidth(this.subHint)));
  } else {
    super.setHint(ellipsizeToWidth(this.hint));
  }
}
 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:19,代码来源:ComposeText.java

示例9: getSpannablePriceTotalText

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
/**
     * Set string with spannable.
     */
    public static SpannableStringBuilder getSpannablePriceTotalText(Context context, String text, String fontPath, boolean setFontBigger) {

        String[] result = text.split("=");
        String first = result[0];
        String second = result[1];
        first = first.concat("=");

        Typeface font = Typeface.createFromAsset(context.getAssets(), fontPath);

        SpannableStringBuilder builder = new SpannableStringBuilder();

        SpannableString dkgraySpannable = new SpannableString(first + "");
        builder.append(dkgraySpannable);

        SpannableString blackSpannable = new SpannableString(second);
        if (setFontBigger) {
            blackSpannable.setSpan(new RelativeSizeSpan(1.3f), 0, second.length(), 0); // set size
        }
//        blackSpannable.setSpan(new CustomTypefaceSpan("", font), 0, second.length(), 0); // font weight
        builder.append(blackSpannable);

        return builder;
    }
 
开发者ID:QuixomTech,项目名称:DeviceInfo,代码行数:27,代码来源:Methods.java

示例10: setPenAttr

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
public void setPenAttr(CaptionPenAttr penAttr) {
    mCharacterStyles.clear();
    if (penAttr.italic) {
        mCharacterStyles.add(new StyleSpan(Typeface.ITALIC));
    }
    if (penAttr.underline) {
        mCharacterStyles.add(new UnderlineSpan());
    }
    switch (penAttr.penSize) {
        case CaptionPenAttr.PEN_SIZE_SMALL:
            mCharacterStyles.add(new RelativeSizeSpan(PROPORTION_PEN_SIZE_SMALL));
            break;
        case CaptionPenAttr.PEN_SIZE_LARGE:
            mCharacterStyles.add(new RelativeSizeSpan(PROPORTION_PEN_SIZE_LARGE));
            break;
    }
    switch (penAttr.penOffset) {
        case CaptionPenAttr.OFFSET_SUBSCRIPT:
            mCharacterStyles.add(new SubscriptSpan());
            break;
        case CaptionPenAttr.OFFSET_SUPERSCRIPT:
            mCharacterStyles.add(new SuperscriptSpan());
            break;
    }
}
 
开发者ID:trevd,项目名称:android_packages_apps_tv,代码行数:26,代码来源:CaptionWindowLayout.java

示例11: endHeader

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
private void endHeader() {
    int len = mResult.length();
    Object obj = getLast(Header.class);

    int where = mResult.getSpanStart(obj);

    mResult.removeSpan(obj);

    // Back off not to change only the text, not the blank line.
    while (len > where && mResult.charAt(len - 1) == '\n') {
        len--;
    }

    if (where != len) {
        Header h = (Header) obj;
        mResult.setSpan(new RelativeSizeSpan(HEADER_SIZES[h.mLevel]), where, len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        mResult.setSpan(new BoldSpan(), where, len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    }
}
 
开发者ID:Ronak-LM,项目名称:memoir,代码行数:20,代码来源:ConverterHtmlToSpanned.java

示例12: initializeResources

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
private void initializeResources() {
  getSupportActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
  getSupportActionBar().setCustomView(R.layout.light_centered_app_title);
  mitigateAndroidTilingBug();

  ImageButton okButton = (ImageButton) findViewById(R.id.ok_button);
  passphraseText       = (EditText)    findViewById(R.id.passphrase_edit);
  SpannableString hint = new SpannableString(getString(R.string.PassphrasePromptActivity_enter_passphrase));

  hint.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
  hint.setSpan(new TypefaceSpan("sans-serif"), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
  hint.setSpan(new ForegroundColorSpan(0x66000000), 0, hint.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
  passphraseText.setHint(hint);
  okButton.setOnClickListener(new OkButtonClickListener());
  passphraseText.setOnEditorActionListener(new PassphraseActionListener());
  passphraseText.setImeActionLabel(getString(R.string.prompt_passphrase_activity__unlock),
                                   EditorInfo.IME_ACTION_DONE);
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:19,代码来源:PassphrasePromptActivity.java

示例13: onTranslationChanged

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
private void onTranslationChanged() throws JSONException {
    SpannableString ss1 = new SpannableString(getResources().getString(R.string.getting_match));
    ss1.setSpan(new RelativeSizeSpan(1.7f), 0, ss1.length(), 0);

    final ProgressDialog progress = new ProgressDialog(this);
    progress.setMessage(ss1);
    progress.setCancelable(false);
    progress.show();

    RequestDelegate requestDelegate = RequestDelegate.getInstance(getApplicationContext());
    requestDelegate.performTranslationChange(prefs.getString("translation", "en-hilali"), getAllCurrentAyahs(), new NetworkRequestCallback() {
        @Override
        public void onSuccess(JSONObject response) {
            Log.v(TAG, response.toString());
            parseTranslationResponse(response);
            progress.dismiss();
        }

        @Override
        public void onFailure(Throwable error) {
            onSearchQueryError(error);
            progress.dismiss();
        }
    });
}
 
开发者ID:Crescent-Labs,项目名称:iqra-android,代码行数:26,代码来源:SearchResultsActivity.java

示例14: processSup

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
private void processSup( boolean opening, Editable output) {
    int len = output.length();
    if(opening) {
        //output.setSpan(new AbsoluteSizeSpan(scriptSize,false), len, len, Spannable.SPAN_MARK_MARK);
        //output.setSpan(new RelativeSizeSpan(0.5f), len, len, Spannable.SPAN_MARK_MARK);
        output.setSpan(new SuperscriptSpan(), len, len, Spannable.SPAN_MARK_MARK);
    } else {
        Object obj = getLast(output, SuperscriptSpan.class);
        int where = output.getSpanStart(obj);
        output.removeSpan(obj);
        //obj = getLast(output, RelativeSizeSpan.class);
        //output.removeSpan(obj);
        if (where != len&&where>=0) {
            //output.setSpan(new AbsoluteSizeSpan(scriptSize, false), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            output.setSpan(new RelativeSizeSpan(0.7f), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            output.setSpan(new SuperscriptSpan(), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        //obj = getLast(output, AbsoluteSizeSpan.class);
        //where = output.getSpanStart(obj);
        //output.removeSpan(obj);
        //if (where != len) {
        //    output.setSpan(new AbsoluteSizeSpan(scriptSize, false), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        //    //output.setSpan(new RelativeSizeSpan(0.5f), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        //}
    }
}
 
开发者ID:tianyuan168326,项目名称:nono-android,代码行数:27,代码来源:MyHtmlTagHandler.java

示例15: formatSignificant

import android.text.style.RelativeSizeSpan; //导入依赖的package包/类
public static void formatSignificant(final Editable s, final RelativeSizeSpan
        insignificantRelativeSizeSpan) {
    s.removeSpan(SIGNIFICANT_SPAN);
    if (insignificantRelativeSizeSpan != null) {
        s.removeSpan(insignificantRelativeSizeSpan);
    }

    final Matcher m = P_SIGNIFICANT.matcher(s);
    if (m.find()) {
        final int pivot = m.group().length();
        s.setSpan(SIGNIFICANT_SPAN, 0, pivot, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        if (s.length() > pivot && insignificantRelativeSizeSpan != null) {
            s.setSpan(insignificantRelativeSizeSpan, pivot, s.length(), Spannable
                    .SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
}
 
开发者ID:chaincloud-dot-com,项目名称:chaincloud-v,代码行数:18,代码来源:BitcoinUtil.java


注:本文中的android.text.style.RelativeSizeSpan类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。