當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。