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


Java BufferType类代码示例

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


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

示例1: showDescriptionLine

import android.widget.TextView.BufferType; //导入依赖的package包/类
/**
 * Sets a description line for the omnibox suggestion.
 *
 * @param str The description text.
 * @param isUrl Whether this text is a URL (as opposed to a normal string).
 */
private void showDescriptionLine(Spannable str, boolean isUrl) {
    TextView textLine = mContentsView.mTextLine2;
    if (textLine.getVisibility() != VISIBLE) {
        textLine.setVisibility(VISIBLE);
    }
    textLine.setText(str, BufferType.SPANNABLE);

    // Force left-to-right rendering for URLs. See UrlBar constructor for details.
    if (isUrl) {
        textLine.setTextColor(URL_COLOR);
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_LTR);
    } else {
        textLine.setTextColor(getStandardFontColor());
        ApiCompatibilityUtils.setTextDirection(textLine, TEXT_DIRECTION_INHERIT);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:SuggestionView.java

示例2: setTextHilighted

import android.widget.TextView.BufferType; //导入依赖的package包/类
public static void setTextHilighted(TextView textView, String text,SearchElement searchElement) {
    textView.setText(text);
    if (textView == null
            || TextUtils.isEmpty(text)
            || searchElement ==null) {
        return;
    }

    int startIndex = searchElement.startIndex;
    int endIndex = searchElement.endIndex;
    if (startIndex < 0 || endIndex > text.length()) {
        return;
    }
    // 开始高亮处理
    int color =  Color.rgb(69, 192, 26);
    textView.setText(text, BufferType.SPANNABLE);
    Spannable span = (Spannable) textView.getText();
    span.setSpan(new ForegroundColorSpan(color), startIndex, endIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:20,代码来源:IMUIHelper.java

示例3: setStatus

import android.widget.TextView.BufferType; //导入依赖的package包/类
public static void setStatus(final TextView textView, final String text) {
        final String htmlText = text + " ";
//        LogUtil.v(TAG, "setStatus:htmlText:" + htmlText);
        final HashMap<String, String> mentions = findMentions(htmlText);
//        LogUtil.v(TAG, "setStatus:mentions:" + mentions);
        final String plainText = Html.fromHtml(htmlText).toString();
//        LogUtil.v(TAG, "setStatus:plainText:" + plainText);
        final SpannableString spannable = new SpannableString(plainText);
        Linkify.addLinks(spannable, Linkify.WEB_URLS);
        linkifyUsers(spannable, mentions);
        linkifyTags(spannable);
        removeUnderLines(spannable);
//        LogUtil.v(TAG, "setStatus:finalText:" + spannable);
        textView.setText(spannable, BufferType.SPANNABLE);
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }
 
开发者ID:Yuijam,项目名称:droidfan,代码行数:17,代码来源:StatusUtils.java

示例4: setItemStatus

import android.widget.TextView.BufferType; //导入依赖的package包/类
public static void setItemStatus(final TextView textView, final String text) {
    final String htmlText = text + " ";
    final List<String> highlightWords = findHighlightWords(htmlText);
    final String plainText = Html.fromHtml(htmlText).toString();
    final SpannableString spannable = new SpannableString(plainText);
    Linkify.addLinks(spannable, Linkify.WEB_URLS);
    final Matcher m = PATTERN_USER.matcher(spannable);
    while (m.find()) {
        int start = m.start(1);
        int end = m.end(1);
        if (start >= 0 && start < end) {
            spannable.setSpan(new ForegroundColorSpan(AppContext.getContext().getResources().getColor(R.color.colorPrimary)), start, end,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
    linkifyTags(spannable);
    removeUnderLines(spannable);
    applyHighlightSpan(spannable, highlightWords);
    textView.setText(spannable, BufferType.SPANNABLE);
}
 
开发者ID:Yuijam,项目名称:droidfan,代码行数:21,代码来源:StatusUtils.java

示例5: applyLetterSpacing

import android.widget.TextView.BufferType; //导入依赖的package包/类
/**
 * 字距为任何字符串(技术上,一个简单的方法为CharSequence不使用)的TextView
 */
private void applyLetterSpacing() {
    if (this == null || this.originalText == null) return;
    StringBuilder builder = new StringBuilder();
    for(int i = 0; i < originalText.length(); i++) {
        String c = ""+ originalText.charAt(i);
        builder.append(c.toLowerCase());
        if(i+1 < originalText.length()) {
            builder.append("\u00A0");
        }
    }
    SpannableString finalText = new SpannableString(builder.toString());
    if(builder.toString().length() > 1) {
        for(int i = 1; i < builder.toString().length(); i+=2) {
            finalText.setSpan(new ScaleXSpan((letterSpacing+1)/10), i, i+1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
    }
    super.setText(finalText, BufferType.SPANNABLE);
}
 
开发者ID:cckevincyh,项目名称:C.,代码行数:22,代码来源:SpacingTextView.java

示例6: fontAndReshape

import android.widget.TextView.BufferType; //导入依赖的package包/类
public static void fontAndReshape(TextView tv) {
	String text = "";

	if (tv.getText() instanceof SpannedString) {
		text = ((SpannedString) tv.getText()).toString();
	} else if (tv.getText() instanceof SpannableString) {
		text = ((SpannableString) tv.getText()).toString();
	} else {
		text = (String) tv.getText();
	}

	if (tv instanceof StyledTextView)
		((StyledTextView) tv).setPlainText(text, BufferType.NORMAL);
	else if (tv instanceof StyledButton)
		((StyledButton) tv).setPlainText(text, BufferType.NORMAL);
	else if (tv instanceof StyledEditText)
		((StyledEditText) tv).setPlainText(text, BufferType.NORMAL);

	tv.setTypeface(getFont("Yekan"));
	tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16);

}
 
开发者ID:backtory,项目名称:neveshtanak-Deprecated-,代码行数:23,代码来源:App.java

示例7: getView

import android.widget.TextView.BufferType; //导入依赖的package包/类
public View getView(final int position, View convertView, ViewGroup parent) {
View row = convertView;
       ViewHolder holder;

if (row == null) {
    row = inflater.inflate(R.layout.search_results_row, null);
           holder = new ViewHolder();
           holder.bookName = (TextView)row.findViewById(R.id.search_result_row_book);
           holder.chapterNumber = (TextView)row.findViewById(R.id.search_result_row_chapter);
           holder.verseNumber = (TextView)row.findViewById(R.id.search_result_row_verse_number);
           holder.verseText = (TextView)row.findViewById(R.id.search_result_row_verse_text);
           row.setTag(holder);
}
       else
           holder = (ViewHolder)row.getTag();

final Verse entry = (Verse)super.getItem(position);

//Log.d(TAG, "Verse: " + entry.number + " - " + entry.text);
holder.bookName.setText(bookNameLookupMap.get(entry.bookId));
holder.chapterNumber.setText("Chapter " + entry.chapter);
holder.verseNumber.setText("[" + entry.number + "]");
holder.verseText.setText(highlightSearchString(entry.text), BufferType.SPANNABLE);

return row;
   }
 
开发者ID:tamzi,项目名称:sophia,代码行数:27,代码来源:SearchResultsAdapter.java

示例8: makeDialog

import android.widget.TextView.BufferType; //导入依赖的package包/类
private static Dialog makeDialog(Context context, int title, Spanned message)
{
	TextView textView = new TextView(context);
	textView.setText(message, BufferType.SPANNABLE );
	textView.setMovementMethod( LinkMovementMethod.getInstance() );

	ScrollView scrollView = new ScrollView(context);
	scrollView.addView( textView );

	final Dialog dialog = new AlertDialog.Builder(context).
	setTitle( title ).
	setView( scrollView ).
	setNeutralButton( "OK", null ).
	setCancelable(true).
	setIcon( android.R.drawable.ic_dialog_info).
	create();
	return dialog;
}
 
开发者ID:serega1983,项目名称:android-openvpn-settings,代码行数:19,代码来源:HtmlDialog.java

示例9: onServiceConnected

import android.widget.TextView.BufferType; //导入依赖的package包/类
public void onServiceConnected(ComponentName className, IBinder service) {
	bService = service;
    mService = new Messenger(service);
    try {
        Message msg = Message.obtain(null, MedtronicConstants.MSG_REGISTER_CLIENT);
        msg.replyTo = mMessenger;
        mService.send(msg);
    } catch (RemoteException e) {
    	
    	 StringBuffer sb1 = new StringBuffer("");
		 sb1.append("EXCEPTION!!!!!! "+ e.getMessage()+" "+e.getCause());
		 for (StackTraceElement st : e.getStackTrace()){
			 sb1.append(st.toString()).append("\n");
		 }
		 Log.e(TAG,"Error Registering Client Service Connection\n"+sb1.toString());
    	if (ISDEBUG){
    		display.setText(display.getText()+"Error Registering Client Service Connection\n", BufferType.EDITABLE);
    	}
        // In this case the service has crashed before we could even do anything with it
    }
}
 
开发者ID:arbox0,项目名称:MedtronicUploader,代码行数:22,代码来源:DexcomG4Activity.java

示例10: initViews

import android.widget.TextView.BufferType; //导入依赖的package包/类
private void initViews() {
	
	SpannableString spannable = new SpannableString(getString(R.string.app_name));
	spannable.setSpan(new ForegroundColorSpan(Color.rgb(99, 194, 208)), 0, 4, 0);
	spannable.setSpan(new ForegroundColorSpan(Color.rgb(255, 255, 255)), 5, 7, 1);
	spannable.setSpan(new ForegroundColorSpan(Color.rgb(255, 212, 0)), 7,spannable.length(), 2);
	
	final TextView appTitle = (TextView) findViewById(R.id.login_app_tittle);
	appTitle.setText(spannable, BufferType.SPANNABLE);

	btnLoginFacebook = (ImageButton) findViewById(R.id.loginFbBtn);
	btnLogin = (ImageButton) findViewById(R.id.loginBtn);
	btnGuest = (ImageButton) findViewById(R.id.loginGuestBtn); 
	btnRegister = (Button) findViewById(R.id.register);
	mTwitterBtn = (ImageButton) findViewById(R.id.loginTwBtn);
	etUsername = (EditText) findViewById(R.id.etLoginUser);
	etPassowrd = (EditText)findViewById(R.id.etLoginPassword);

	btnLogin.setOnClickListener(this);
	btnLoginFacebook.setOnClickListener(this);
	btnRegister.setOnClickListener(this);
	btnGuest.setOnClickListener(this);
	mTwitterBtn.setOnClickListener(this);
	
}
 
开发者ID:kodamirmo,项目名称:LostAndFound,代码行数:26,代码来源:LoginScreen.java

示例11: addOrRemoveAppView

import android.widget.TextView.BufferType; //导入依赖的package包/类
void addOrRemoveAppView(final ISearchableElement searchableElement, final Match match) {
	final View appView = searchableElement.getViewDetails().getSearchResultView();
	final boolean matches = match.isMatches();
	ViewDetails viewDetails = searchableElement.getViewDetails();
	final TextView primaryTextDisplay = viewDetails.getPrimaryTextDisplay();
	runOnUiThread(new Runnable(){
		@Override
		public void run() {
			if(matches){
				if(appView.getParent() == null){
						searchResultsView.addView(appView);
					searchResultsCount++;
				}
			} else {
				if(appView.getParent() == searchResultsView){
					searchResultsView.removeView(appView);
					searchResultsCount--;
				}
			}
			searchCountText.setText(String.valueOf(searchResultsCount));
			primaryTextDisplay.setText(match.getMatchedSpan(),BufferType.SPANNABLE);
		}
	});
}
 
开发者ID:RamAnvesh,项目名称:omnisearch,代码行数:25,代码来源:OmniSearchHome.java

示例12: priceFee

import android.widget.TextView.BufferType; //导入依赖的package包/类
@Override
    public void priceFee(String totalCostStr) {
//        mFreight_money.setText("RMB:"+totalCostStr);

        SpannableString styledText = new SpannableString("RMB"+totalCostStr);
        styledText.setSpan(new AbsoluteSizeSpan(15,true), 0, 4, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        styledText.setSpan(new AbsoluteSizeSpan(20,true), 3, ("RMB"+totalCostStr).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        mFreight_money.setText(styledText, BufferType.SPANNABLE);
    }
 
开发者ID:Zyj163,项目名称:yyox,代码行数:10,代码来源:ServicePriceActivity.java

示例13: onSetUpView

import android.widget.TextView.BufferType; //导入依赖的package包/类
@Override
public void onSetUpView() {
    EMTextMessageBody txtBody = (EMTextMessageBody) message.getBody();
    Spannable span = EaseSmileUtils.getSmiledText(context, txtBody.getMessage());
    // 设置内容
    contentView.setText(span, BufferType.SPANNABLE);

    handleTextMessage();
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:10,代码来源:EaseChatRowText.java

示例14: setLikeUsers

import android.widget.TextView.BufferType; //导入依赖的package包/类
public void setLikeUsers(Context contet, TextView likeUser, boolean limit) {
    // 构造多个超链接的html, 通过选中的位置来获取用户名
    if (getLikeCount() > 0 && getLikeUser() != null
            && !getLikeUser().isEmpty()) {
        likeUser.setVisibility(View.VISIBLE);
        likeUser.setMovementMethod(LinkMovementMethod.getInstance());
        likeUser.setFocusable(false);
        likeUser.setLongClickable(false);
        likeUser.setText(addClickablePart(contet, limit), BufferType.SPANNABLE);
    } else {
        likeUser.setVisibility(View.GONE);
        likeUser.setText("");
    }
    likeUser.setVisibility(View.GONE);
}
 
开发者ID:hsj-xiaokang,项目名称:OSchina_resources_android,代码行数:16,代码来源:Tweet.java

示例15: setText

import android.widget.TextView.BufferType; //导入依赖的package包/类
public void setText(CharSequence text, BufferType type) {
    try {
        if (!TextUtils.isEmpty(text)) {
            SpannableStringBuilder builder = new SpannableStringBuilder(text);
            EmojiconHandler.addEmojis(getContext(), builder, this.mEmojiconSize, this
                    .mTextStart, this.mTextLength, this.mUseSystemDefault);
            text = builder;
        }
        super.setText(text, type);
    } catch (IndexOutOfBoundsException e) {
        setText(text.toString());
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:14,代码来源:EmojiconTextView.java


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