本文整理汇总了Java中android.widget.TextSwitcher.setText方法的典型用法代码示例。如果您正苦于以下问题:Java TextSwitcher.setText方法的具体用法?Java TextSwitcher.setText怎么用?Java TextSwitcher.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.TextSwitcher
的用法示例。
在下文中一共展示了TextSwitcher.setText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: spinAllSwitchers
import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void spinAllSwitchers() {
// deal with digits
digits[0].setText(DIGITS[random.nextInt(10)]);
int multiplier = 1;
for (int i = 1; i < digits.length; i++) {
if (digits[i].getVisibility() == GONE) {
// reached the end, quit
break;
}
multiplier *= 10;
if ((value * multiplier) > (multiplier - 1)) {
digits[i].setText(DIGITS[random.nextInt(10)]);
}
}
if (value % 1 > 0 || forceDedimal) {
for (final TextSwitcher decimal : decimals) {
decimal.setText(DIGITS[random.nextInt(10)]);
}
}
}
示例2: setText
import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void setText(CharSequence text, boolean animate) {
View view = getView();
if (view == null) {
return;
}
TextSwitcher textSwitcher = (TextSwitcher) view;
if (animate) {
textSwitcher.setText(text);
} else {
TextView curr = (TextView) textSwitcher.getCurrentView();
curr.setText(text);
}
//
// waiting for the first layout of SWITCHER to be finished,
// so that we can adjust its size according to its content.
//
// 100 ms
//
schedule(MSG_TEXT_VIEW_ADJUST_HEIGHT, 100);
}
示例3: onConversionRatesUpdated
import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void onConversionRatesUpdated(List<ConversionRate> conversionRates) {
View rootView = getView();
if (rootView == null) {
Log.e(LOG_TAG, "rootView was null in onConversionRatesUpdated");
return;
}
// Find updated rate of currently selected conversion rate
ListView listView = getListView();
Cursor cursor = (Cursor) listView.getItemAtPosition(listView.getCheckedItemPosition());
ConversionRate selectedConversionRate = ConverterDbHelper.conversionRateFromCursor(cursor);
ConversionRate updatedConversionRate = conversionRates.get(conversionRates.indexOf(selectedConversionRate));
// Store updated rate and notify the Convert tab about it
Settings.writeConversionRate(getActivity(), updatedConversionRate);
mListener.onConversionRatesUpdated();
// Enable update button and set status text
Button updateButton = (Button) rootView.findViewById(R.id.button_update_conversion_rates);
updateButton.setEnabled(true);
TextSwitcher statusText = (TextSwitcher) rootView.findViewById(R.id.textswitcher_update_conversion_rates);
statusText.setText(getString(R.string.updated));
clearUpdateStatusAfterDelay(statusText);
}
示例4: jmResultsCallback
import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void jmResultsCallback(List<EntryOptimized> results, SearchInfo search) {
StringBuilder sb = new StringBuilder();
for (EntryOptimized eo : results){
sb.append(eo.getKanji());
if (!eo.getReadings().isEmpty()){
sb.append(" (");
sb.append(eo.getReadings());
sb.append(")");
}
sb.append("\n");
sb.append(eo.getMeanings());
sb.append("\n\n");
}
if (sb.length() > 2){
sb.setLength(sb.length() - 1);
}
TextSwitcher tv = (TextSwitcher) mLinearLayout.findViewById(R.id.jm_results);
tv.setText(sb.toString());
int start = mKanjiGrid.getKanjiViewList().indexOf(search.getKanjiCharacterView());
if (results.size() > 0){
String kanji = results.get(0).getKanji();
for (int i = start; i < start + kanji.codePointCount(0, kanji.length()); i++){
mKanjiGrid.getKanjiViewList().get(i).setBackground();
}
}
else {
mKanjiGrid.getKanjiViewList().get(start).setBackground();
}
}
示例5: kd2ResultsCallback
import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void kd2ResultsCallback(List<CharacterOptimized> results, SearchInfo search) {
StringBuilder sb = new StringBuilder();
for (CharacterOptimized co : results){
sb.append(co.getKanji());
if (!co.getOnyomi().isEmpty()){
sb.append(" (");
sb.append(co.getOnyomi());
sb.append(") ");
}
if (!co.getKunyomi().isEmpty()){
sb.append(" [");
sb.append(co.getKunyomi());
sb.append("] ");
}
sb.append("\n");
sb.append(co.getMeaning());
sb.append("\n\n");
}
if (sb.length() > 2){
sb.setLength(sb.length() - 2);
}
TextSwitcher tv = (TextSwitcher) mLinearLayout.findViewById(R.id.kd2_results);
tv.setText(sb.toString());
}
示例6: updateTimeCounterTextSwitcher
import android.widget.TextSwitcher; //导入方法依赖的package包/类
public void updateTimeCounterTextSwitcher(final long timeMills){
if(this.timeCounterTextSwitcher == null) return;
final TextSwitcher currentTimeCounterTextSwitcher = this.timeCounterTextSwitcher;
final BaseActivity baseActivity = this.timeBasedTask.getBaseActivity();
Runnable timerTextRunnable = new Runnable() {
public void run() {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(timeMills);
Date currentCountDownDate = calendar.getTime();
String dateStr = DateUtil.convertDateToString(currentCountDownDate, DateUtil.DEFAULT_QUIZ_DISPLAY_DATE_FORMAT);
currentTimeCounterTextSwitcher.setText(dateStr);
}
};
baseActivity.runOnUiThread(timerTextRunnable);
}
示例7: updateConversionRates
import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void updateConversionRates(View updateButton) {
Log.i(LOG_TAG, "Updating conversion rates");
TextSwitcher updateText = (TextSwitcher) getActivity().findViewById(R.id.textswitcher_update_conversion_rates);
updateText.setText(getString(R.string.fetching_conversion_rates));
updateButton.setEnabled(false);
new FetchConversionRatesTask(getActivity(), this).execute();
}
示例8: onUpdateFailed
import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void onUpdateFailed(String errorMessage) {
View rootView = getView();
if (rootView == null) {
Log.e(LOG_TAG, "rootView was null in onUpdateFailed");
return;
}
// Enable update button and set status text
Button updateButton = (Button) rootView.findViewById(R.id.button_update_conversion_rates);
updateButton.setEnabled(true);
TextSwitcher statusText = (TextSwitcher) rootView.findViewById(R.id.textswitcher_update_conversion_rates);
statusText.setText(errorMessage);
}
示例9: onCreate
import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
fab = (FloatingActionButton) findViewById(R.id.fab);
mSheetLayout = (SheetLayout) findViewById(R.id.bottom_sheet);
Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewpager);
mTabLayout = (TabLayout) findViewById(R.id.tabs);
mProgressBar = (ProgressBar) findViewById(R.id.progress_wheel_main);
setSupportActionBar(mToolbar);
setupViewPager(viewPager);
if (mTabLayout != null) {
mTabLayout.setupWithViewPager(viewPager);
}
viewPager.setCurrentItem(1);
setupTabIcons();
if (mSheetLayout != null) {
mSheetLayout.setFab(fab);
mSheetLayout.setFabAnimationEndListener(this);
}
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mSheetLayout.expandFab();
}
});
mSwitcher = (TextSwitcher) findViewById(R.id.textSwitcher);
mSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
public View makeView() {
TextView textView = new TextView(MainActivity.this);
textView.setGravity(Gravity.START);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
textView.setTextAppearance(R.style.TitleTextApperance);
} else {
textView.setTextAppearance(MainActivity.this, R.style.TitleTextApperance);
}
return textView;
}
});
mSwitcher.setText(mTabNames[1]);
viewPagerListener(viewPager);
//showFeedback();
updateRealmDB();
}
示例10: clearUpdateStatusAfterDelay
import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void clearUpdateStatusAfterDelay(final TextSwitcher statusText) {
Runnable timerRunnable = () -> statusText.setText("");
mTimerHandler.postDelayed(timerRunnable, STATUS_RESET_DELAY_MS);
}