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


Java TextView.append方法代码示例

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


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

示例1: dealUnderLinesData

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * 解析link
 *
 * @param tv_content
 * @param context
 */
private static void dealUnderLinesData(TextView tv_content, Context context) {
    CharSequence charSequence = tv_content.getText();
    if (charSequence instanceof Spannable) {
        tv_content.setText("");
        Spannable s = EmojiDisplay.spannableFilter(tv_content.getContext(),
                new SpannableStringBuilder(charSequence),
                charSequence,
                EmoticonsKeyboardUtils.getFontHeight(tv_content));
        URLSpan[] spans = s.getSpans(0, s.length(), URLSpan.class);
        for (URLSpan span : spans) {
            int start = s.getSpanStart(span);
            int end = s.getSpanEnd(span);
            String clickText = s.subSequence(start, end).toString();
            URLSpanNoUnderline urlSpanNoUnderline = new URLSpanNoUnderline(context, span.getURL(), clickText);
            s.setSpan(urlSpanNoUnderline, start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        }
        tv_content.append(s);
    }
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:26,代码来源:CustomTextView.java

示例2: onViewCreated

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
	final TextView logText = (TextView) view.findViewById(R.id.logtext);
	IntentFilter statusIntentFilter = new IntentFilter(ServiceUtils.ACTION_LOGBROADCAST);
	BroadcastReceiver statusReceiver = new BroadcastReceiver() {
		@Override
		public void onReceive(Context context, Intent intent) {
			if (intent.hasExtra(ServiceUtils.EXTENDED_DATA_LOG)) {
				logText.append("\n");
				logText.append(intent.getStringExtra(ServiceUtils.EXTENDED_DATA_LOG));
				Log.d("received", intent.getStringExtra(ServiceUtils.EXTENDED_DATA_LOG));
			}
		}
	};
	LocalBroadcastManager.getInstance(getActivity()).registerReceiver(statusReceiver, statusIntentFilter);
}
 
开发者ID:comp500,项目名称:SSLSocks,代码行数:17,代码来源:LogFragment.java

示例3: onPostExecute

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected final void onPostExecute(Object arg) {
  TextView textView = textViewRef.get();
  if (textView != null) {
    for (CharSequence content : newContents) {
      textView.append(content);
    }
    textView.setMovementMethod(LinkMovementMethod.getInstance());
  }
  HistoryManager historyManager = historyManagerRef.get();
  if (historyManager != null) {
    for (String[] text : newHistories) {
      historyManager.addHistoryItemDetails(text[0], text[1]);
    }
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:SupplementalInfoRetriever.java

示例4: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // COMPLETED (3) Use findViewById to get a reference to the TextView from the layout
    mToysListTextView = (TextView) findViewById(R.id.tv_toy_names);

    // COMPLETED (4) Use the static ToyBox.getToyNames method and store the names in a String array
    String toyNames[] = ToyBox.getToyNames();

    // COMPLETED (5) Loop through each toy and append the name to the TextView (add \n for spacing)
    for(String toyName:toyNames) {
        mToysListTextView.append(toyName + "\n\n\n");
    }
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:17,代码来源:MainActivity.java

示例5: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.receive_share);

    Button sendButton = (Button)findViewById(R.id.send_to_service);
    final Uri uri = getShareUri(getIntent());
    if (uri != null) {
        sendButton.setEnabled(true);
    } else {
        sendButton.setEnabled(false);
    }

    TextView content = (TextView)findViewById(R.id.receive_share_data);
    content.append(buildShareInfo(getContentResolver(), getIntent()));

    // Watch for button clicks.
    sendButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(ReceiveShare.this, ReceiveShareService.class);
            intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
            ClipData clip = ClipData.newUri(getContentResolver(), "Something", uri);
            intent.setClipData(clip);
            startService(intent);
            finish();
        }
    });
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:31,代码来源:ReceiveShare.java

示例6: into

import android.widget.TextView; //导入方法依赖的package包/类
public void into(@NonNull final TextView textView) {
  checkNotNull(textView, "textView == null");

  for (final Spannable spannable : spannables) {
    textView.append(spannable);
  }
}
 
开发者ID:vanniktech,项目名称:TextBuilder,代码行数:8,代码来源:TextBuilder.java

示例7: line

import android.widget.TextView; //导入方法依赖的package包/类
void line (TextView tv)
   {
String temp;

switch (storageType) {
    case 0: temp = "undefined"; break;
    case 1: temp = "Fixed ROM"; break;
    case 2: temp = "Removable ROM"; break;
    case 3: temp = "Fixed RAM"; break;
    case 4: temp = "Removable RAM"; break;
    default:
	temp = "Reserved-0x" + Integer.toHexString (storageType);
}
tv.append  ("Storage Type: " + temp +" \n");
   }
 
开发者ID:iyundong,项目名称:InstantUpload,代码行数:16,代码来源:StorageInfo.java

示例8: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_range_layout);
    TextView textView = (TextView) findViewById(R.id.text_name);
    textView.setText("D");
    findViewById(R.id.btn_start_activity).setVisibility(View.GONE);

    findViewById(R.id.btn_finish_range_by_class).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_range_begin_router_path1).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_range_begin_router_path2).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_range_begin_router_path3).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_start_to).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_start_to_by_router_path).setVisibility(View.VISIBLE);

    findViewById(R.id.btn_finish_top_activity).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_activity_by_class).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_activity_by_router_path).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_activity).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_activity_except_activity_class).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_activity_except_router_path).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_activity_except_by_list).setVisibility(View.VISIBLE);
    findViewById(R.id.btn_finish_all_activity_by_list).setVisibility(View.VISIBLE);


    int count = RouterActivityManager.get().getActivityCount();
    textView.append("\n\nactivity count:");
    textView.append("" + count);
}
 
开发者ID:chiclaim,项目名称:MRouter,代码行数:30,代码来源:DActivity.java

示例9: onPostExecute

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected final void onPostExecute(Object arg) {
    TextView textView = textViewRef.get();
    if (textView != null) {
        for (CharSequence content : newContents) {
            textView.append(content);
        }
        textView.setMovementMethod(LinkMovementMethod.getInstance());
    }
}
 
开发者ID:xiong-it,项目名称:ZXingAndroidExt,代码行数:11,代码来源:SupplementalInfoRetriever.java

示例10: createNoticeView

import android.widget.TextView; //导入方法依赖的package包/类
private TextView createNoticeView(BannerBean content) {
    TextView view = new TextView(mContext);
    view.setText(content.getTitle());
    view.append("\n");
    view.append(content.getTitle2());
    view.setTextColor(mContext.getResources().getColor(R.color.color_text));
    view.setGravity(Gravity.CENTER_VERTICAL);

    return view;
}
 
开发者ID:AndroidWJC,项目名称:UnversityFinance,代码行数:11,代码来源:MyAsyncTask.java

示例11: span

import android.widget.TextView; //导入方法依赖的package包/类
public static void span(String text, TextView textView) {
    SpannableString spanText = new SpannableString(text);
    spanText.setSpan(new ForegroundColorSpan(Color.GRAY), 0, text.length(), 0);
    spanText.setSpan(new StyleSpan(Typeface.BOLD), 0, text.length(), 0);

    textView.setText("");
    textView.append(spanText);
}
 
开发者ID:kerick-jeff,项目名称:MyBP,代码行数:9,代码来源:Span.java

示例12: parseTextContent

import android.widget.TextView; //导入方法依赖的package包/类
/**
 *   解析文本中的图片
 */
private void parseTextContent(TextView textView, String content) {
    // TODO: 2017/7/11 0011 后续可以找到图片后,显示在列表item上 

    textView.setText("");

    Pattern p = Pattern.compile(EditNoteConstans.imageTabBefore+"([^<]*)"+EditNoteConstans.imageTabAfter);
    Matcher m = p.matcher(content);
    int tempIndex = 0;
    List<String> textList=new ArrayList<>();
    while (m.find()) {
        
        //  匹配到的数据中,第一个括号的中的内容(这里只有一个括号)
        String temp = m.group(1);
        
        //  查找图片标签的位置
        int index = content.indexOf(EditNoteConstans.imageTabBefore, tempIndex);
        
        //  将本次开始位置到图片标签间的图片储存起来
        String text = content.substring(tempIndex, index);
        textList.add(text);
        
        // 将查询起始位置升级
        int flagLength=EditNoteConstans.imageTabBefore.length()+EditNoteConstans.imageTabAfter.length();
        tempIndex = index + flagLength + temp.length();
    }

    if(textList.size()!=0){
        for (int i=0;i<textList.size();i++){
            textView.append(textList.get(i));
            textView.append("[图片]");
        }
        // 将最后一个图片标签后面所有的文字添加
        textView.append(content.substring(tempIndex));
    }else{
        textView.setText(content);
    }
}
 
开发者ID:ifadai,项目名称:SuperNote,代码行数:41,代码来源:RvNoteListAdapter.java

示例13: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    /*
     * Using findViewById, we get a reference to our TextView from xml. This allows us to
     * do things like set the text of the TextView.
     */
    mToysListTextView = (TextView) findViewById(R.id.tv_toy_names);

    /*
     * This String array contains names of classic toys. After all, these are toy apps. We
     * wanted to create a way to break concepts down into smaller pieces that we thought might
     * be a little easier to understand. In each lesson, we'll demonstrate new concepts using a
     * toy app (no, sadly every one won't have ACTUAL toys in it) and then we'll guide you
     * through adding the functionality that you've just learned by having you use those
     * concepts in Sunshine! Let us know what you think! We're really excited to have you
     * taking this course.
     */
    String[] toyNames = ToyBox.getToyNames();

    /*
     * Iterate through the array and append the Strings to the TextView. The reason why we add
     * the "\n\n\n" after the String is to give visual separation between each String in the
     * TextView. Later, we'll learn about a better way to display lists of data.
     */
    for (String toyName : toyNames) {
        mToysListTextView.append(toyName + "\n\n\n");
    }
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:32,代码来源:MainActivity.java

示例14: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
/**
 * Called when the activity is first created. This is where you should do all of your normal
 * static set up: create views, bind data to lists, etc.
 * <p>
 * Always followed by onStart().
 *
 * @param savedInstanceState The Activity's previously frozen state, if there was one.
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mLifecycleDisplay = (TextView) findViewById(R.id.tv_lifecycle_events_display);

    /*
     * If savedInstanceState is not null, that means our Activity is not being started for the
     * first time. Even if the savedInstanceState is not null, it is smart to check if the
     * bundle contains the key we are looking for. In our case, the key we are looking for maps
     * to the contents of the TextView that displays our list of callbacks. If the bundle
     * contains that key, we set the contents of the TextView accordingly.
     */
    if (savedInstanceState != null) {
        if (savedInstanceState.containsKey(LIFECYCLE_CALLBACKS_TEXT_KEY)) {
            String allPreviousLifecycleCallbacks = savedInstanceState
                    .getString(LIFECYCLE_CALLBACKS_TEXT_KEY);
            mLifecycleDisplay.setText(allPreviousLifecycleCallbacks);
        }
    }

    // COMPLETED (4) Iterate backwards through mLifecycleCallbacks, appending each String and a newline to mLifecycleDisplay
    for (int i = mLifecycleCallbacks.size() - 1; i >= 0; i--) {
        mLifecycleDisplay.append(mLifecycleCallbacks.get(i) + "\n");
    }
    // COMPLETED (5) Clear mLifecycleCallbacks after iterating through it
    mLifecycleCallbacks.clear();

    logAndAppend(ON_CREATE);
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:40,代码来源:MainActivity.java

示例15: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_forecast);

    // COMPLETED (2) Use findViewById to get a reference to the weather display TextView
    mWeatherTextView = (TextView) findViewById(R.id.tv_weather_data);

    // COMPLETED (3) Create an array of Strings that contain fake weather data
    String[] dummyWeatherData = {
            "Today, May 17 - Clear - 17°C / 15°C",
            "Tomorrow - Cloudy - 19°C / 15°C",
            "Thursday - Rainy- 30°C / 11°C",
            "Friday - Thunderstorms - 21°C / 9°C",
            "Saturday - Thunderstorms - 16°C / 7°C",
            "Sunday - Rainy - 16°C / 8°C",
            "Monday - Partly Cloudy - 15°C / 10°C",
            "Tue, May 24 - Meatballs - 16°C / 18°C",
            "Wed, May 25 - Cloudy - 19°C / 15°C",
            "Thu, May 26 - Stormy - 30°C / 11°C",
            "Fri, May 27 - Hurricane - 21°C / 9°C",
            "Sat, May 28 - Meteors - 16°C / 7°C",
            "Sun, May 29 - Apocalypse - 16°C / 8°C",
            "Mon, May 30 - Post Apocalypse - 15°C / 10°C",
    };

    // COMPLETED (4) Append each String from the fake weather data array to the TextView
    for (String dummyWeatherDay : dummyWeatherData) {
        mWeatherTextView.append(dummyWeatherDay + "\n\n\n");
    }
}
 
开发者ID:fjoglar,项目名称:android-dev-challenge,代码行数:32,代码来源:MainActivity.java


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