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


Java TextSwitcher.setFactory方法代码示例

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


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

示例1: initSwitchers

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void initSwitchers() {
    temperatureSwitcher = (TextSwitcher) findViewById(R.id.cs_ts_temperature);
    temperatureSwitcher.setFactory(new TextViewFactory(R.style.CsTemperatureTextView, true));
    temperatureSwitcher.setCurrentText(temperatures[0]);

    placeSwitcher = (TextSwitcher) findViewById(R.id.cs_ts_place);
    placeSwitcher.setFactory(new TextViewFactory(R.style.CsPlaceTextView, false));
    placeSwitcher.setCurrentText(places[0]);

    clockSwitcher = (TextSwitcher) findViewById(R.id.cs_ts_clock);
    clockSwitcher.setFactory(new TextViewFactory(R.style.CsClockTextView, false));
    clockSwitcher.setCurrentText(times[0]);

    descriptionsSwitcher = (TextSwitcher) findViewById(R.id.cs_ts_description);
    descriptionsSwitcher.setInAnimation(this, android.R.anim.fade_in);
    descriptionsSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    descriptionsSwitcher.setFactory(new TextViewFactory(R.style.CsDescriptionTextView, false));
    descriptionsSwitcher.setCurrentText(getString(descriptions[0]));

    mapSwitcher = (ImageSwitcher) findViewById(R.id.cs_ts_map);
    mapSwitcher.setInAnimation(this, R.anim.cs_fade_in);
    mapSwitcher.setOutAnimation(this, R.anim.cs_fade_out);
    mapSwitcher.setFactory(new ImageViewFactory());
    mapSwitcher.setImageResource(maps[0]);
}
 
开发者ID:Ramotion,项目名称:showroom-android,代码行数:26,代码来源:CardSliderActivity.java

示例2: setupPassageSection

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void setupPassageSection(Devotional dev, View view) {
	TextView verses = (TextView) view.findViewById(R.id.dev_passage_verses);
	verses.setText(dev.getPassages());

	this.passages = passageDb.readPassages(dev.getGuid());

	passageContent = (TextSwitcher) view.findViewById(R.id.dev_passage_content);
	passageContent.setFactory(new ViewSwitcher.ViewFactory() {
		public View makeView() {
			TextView myText = new TextView(ShowDevotionalActivity.this);
			return myText;
		}
	});
	Animation in = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
	passageContent.setInAnimation(in);

	Spinner transSelector = (Spinner) view.findViewById(R.id.dev_passage_translation_selector);
	ArrayAdapter<Translation> transSelAdapter = new ArrayAdapter<>(this, android.R.layout
			.simple_spinner_item, Translation.values());
	transSelAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
	transSelector.setAdapter(transSelAdapter);
	transSelector.setOnItemSelectedListener(this);
}
 
开发者ID:turbohappy,项目名称:ljcbestill,代码行数:24,代码来源:ShowDevotionalActivity.java

示例3: initializeTextSwitcher

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void initializeTextSwitcher(@NonNull final Context context) {
    selectedTextView = new TextSwitcher(getContext());
    selectedTextView.setFactory(this);
    selectedTextView.setAnimateFirstView(false);
    selectedTextView.setBackgroundResource(mSelectedTextBackground);

    if (mTextSwitcherInAnimation != 0) {
        selectedTextView.setInAnimation(context, mTextSwitcherInAnimation);
    }

    if (mTextSwitcherOutAnimation != 0) {
        selectedTextView.setOutAnimation(context, mTextSwitcherOutAnimation);
    }

    LayoutParams params = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    selectedTextView.setLayoutParams(params);
    selectedTextView.setLayerType(LAYER_TYPE_HARDWARE, null);
    addView(selectedTextView);
}
 
开发者ID:sephiroth74,项目名称:OverlayMenu,代码行数:21,代码来源:OverMenuLayout.java

示例4: onCreate

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

    setContentView(R.layout.text_switcher_1);

    mSwitcher = (TextSwitcher) findViewById(R.id.switcher);
    mSwitcher.setFactory(this);

    Animation in = AnimationUtils.loadAnimation(this,
            android.R.anim.fade_in);
    Animation out = AnimationUtils.loadAnimation(this,
            android.R.anim.fade_out);
    mSwitcher.setInAnimation(in);
    mSwitcher.setOutAnimation(out);

    Button nextButton = (Button) findViewById(R.id.next);
    nextButton.setOnClickListener(this);

    updateCounter();
}
 
开发者ID:luoqii,项目名称:ApkLauncher,代码行数:22,代码来源:TextSwitcher1.java

示例5: onCreate

import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.main);
	textview = (TextView) findViewById(R.id.textview);
	// ���TextSwitch�����ã�
	mTextSwitcher = (TextSwitcher) findViewById(R.id.your_textview);
     //ָ��TextSwitcher��viewFactory
	mTextSwitcher.setFactory(new ViewFactory() {
		@Override
		public View makeView() {
			TextView t = new TextView(MainActivity.this);
			t.setGravity(Gravity.CENTER);
			return t;
		}
	});
	// �������붯��Ч��,ʹ��ϵͳ��̸��Ч����Ҳ�����Զ���
	mTextSwitcher.setInAnimation(this, android.R.anim.fade_in);
	// �����г�����Ч����ʹ��ϵͳ��̸��Ч����Ҳ�����Զ���
	mTextSwitcher.setOutAnimation(this, android.R.anim.fade_out);

	onSwitchText(null);
}
 
开发者ID:PeoceWang,项目名称:animTextview,代码行数:24,代码来源:MainActivity.java

示例6: onCreateView

import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    mListAdapter = new ConversionRateListAdapter(getActivity(), null, 0);
    setListAdapter(mListAdapter);

    View rootView = inflater.inflate(R.layout.fragment_currencies, container, false);

    Button updateButton = (Button) rootView.findViewById(R.id.button_update_conversion_rates);
    updateButton.setOnClickListener(this);

    final Context context = getActivity();
    TextSwitcher updateText = (TextSwitcher) rootView.findViewById(R.id.textswitcher_update_conversion_rates);
    Animation in = AnimationUtils.loadAnimation(context, android.R.anim.fade_in);
    Animation out = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
    updateText.setInAnimation(in);
    updateText.setOutAnimation(out);
    updateText.setFactory(() -> {
        TextView textView = new TextView(context);
        textView.setGravity(Gravity.CENTER);
        return textView;
    });

    return rootView;
}
 
开发者ID:peruukki,项目名称:SimpleCurrencyConverter,代码行数:26,代码来源:CurrenciesFragment.java

示例7: initTextSwitcher

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void initTextSwitcher() {
    mTextSwitcher = (TextSwitcher) findViewById(R.id.tv_switcher);
    Animation in = AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
    Animation out = AnimationUtils.loadAnimation(this,android.R.anim.fade_out);
    mTextSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            TextView tv = new TextView(TextAndImageAnimation.this);
            tv.setGravity(Gravity.CENTER);
            return tv;
        }
    });
    mTextSwitcher.setInAnimation(in);
    mTextSwitcher.setOutAnimation(out);
    mTextChangeRunnable = new ChangeTextRunnable();
}
 
开发者ID:yftx,项目名称:50AndroidHacks,代码行数:17,代码来源:TextAndImageAnimation.java

示例8: initSwitchers

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void initSwitchers() {
    temperatureSwitcher = (TextSwitcher) findViewById(R.id.ts_temperature);
    temperatureSwitcher.setFactory(new TextViewFactory(R.style.TemperatureTextView, true));
    temperatureSwitcher.setCurrentText(temperatures[0]);

    placeSwitcher = (TextSwitcher) findViewById(R.id.ts_place);
    placeSwitcher.setFactory(new TextViewFactory(R.style.PlaceTextView, false));
    placeSwitcher.setCurrentText(places[0]);

    clockSwitcher = (TextSwitcher) findViewById(R.id.ts_clock);
    clockSwitcher.setFactory(new TextViewFactory(R.style.ClockTextView, false));
    clockSwitcher.setCurrentText(times[0]);

    descriptionsSwitcher = (TextSwitcher) findViewById(R.id.ts_description);
    descriptionsSwitcher.setInAnimation(this, android.R.anim.fade_in);
    descriptionsSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    descriptionsSwitcher.setFactory(new TextViewFactory(R.style.DescriptionTextView, false));
    descriptionsSwitcher.setCurrentText(getString(descriptions[0]));

    mapSwitcher = (ImageSwitcher) findViewById(R.id.ts_map);
    mapSwitcher.setInAnimation(this, R.anim.fade_in);
    mapSwitcher.setOutAnimation(this, R.anim.fade_out);
    mapSwitcher.setFactory(new ImageViewFactory());
    mapSwitcher.setImageResource(maps[0]);

    mapLoadListener = new DecodeBitmapTask.Listener() {
        @Override
        public void onPostExecuted(Bitmap bitmap) {
            ((ImageView)mapSwitcher.getNextView()).setImageBitmap(bitmap);
            mapSwitcher.showNext();
        }
    };
}
 
开发者ID:Ramotion,项目名称:cardslider-android,代码行数:34,代码来源:MainActivity.java

示例9: onFinishInflate

import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override protected void onFinishInflate() {
  super.onFinishInflate();
  modifierTitle = (TextView) findViewById(R.id.bike_image_modifier_title);
  textSwitcher = (TextSwitcher) findViewById(R.id.text_switcher);
  textSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
    @Override public View makeView() {
      return LayoutInflater.from(getContext()).inflate(R.layout.modifier_value_textview, null);
    }
  });
}
 
开发者ID:square,项目名称:point-of-sale-android-sdk,代码行数:11,代码来源:BikeModifierView.java

示例10: setupTextSwitcher

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void setupTextSwitcher(TextSwitcher textSwitcher) {
    textSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            TextView textView = new TextView(getContext());
            textView.setTextSize(textSize);
            textView.setTextColor(textColor);
            return textView;
        }
    });
    textSwitcher.setInAnimation(getInAnimation());
    textSwitcher.setOutAnimation(getContext(), slideOutAnimation);
}
 
开发者ID:everalbum,项目名称:roliedex,代码行数:14,代码来源:RoliedexLayout.java

示例11: onCreate

import android.widget.TextSwitcher; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
protected void onCreate(Bundle savedInstanceState) {
    overridePendingTransition(0, 0);
    super.onCreate(savedInstanceState);
    swipeBackDelegate = new SwipeBackDelegate();
    swipeBackDelegate.attach(this, R.layout.web_activity_web);
    swipeBackDelegate.setDragEdge(DragEdge.VERTICAL);
    /* setContentView(R.layout.web_activity_web); */

    progressbar = (NumberProgressBar) findViewById(R.id.progressbar);
    webView = (ObservableWebView) findViewById(R.id.web_view);
    textSwitcher = (TextSwitcher) findViewById(R.id.title);

    url = getIntent().getStringExtra(EXTRA_URL);
    title = getIntent().getStringExtra(EXTRA_TITLE);

    WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setLoadWithOverviewMode(true);
    settings.setAppCacheEnabled(true);
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    settings.setSupportZoom(true);
    settings.setDomStorageEnabled(true);
    webView.setWebChromeClient(new ChromeClient());
    webView.setWebViewClient(new ReloadableClient());
    webView.setOnScrollChangedListener(this);
    // webView.addJavascriptInterface(new JSInterface(), "JSInterface");

    webView.loadUrl(url);

    textSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @SuppressWarnings("deprecation")
        @Override
        public View makeView() {
            final Context context = WebActivity.this;
            final TextView textView = new TextView(context);
            textView.setTextAppearance(context, R.style.WebTitle);
            textView.setSingleLine(true);
            textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(final View v) {
                    v.setSelected(!v.isSelected());
                }
            });
            return textView;
        }
    });
    textSwitcher.setInAnimation(this, android.R.anim.fade_in);
    textSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    if (title != null) setTitle(title);
}
 
开发者ID:drakeet,项目名称:rebase-android,代码行数:54,代码来源:WebActivity.java

示例12: 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();
}
 
开发者ID:chashmeetsingh,项目名称:TrackIt-Android,代码行数:54,代码来源:MainActivity.java

示例13: onCreate

import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        ((IslamicLibraryApplication) getApplication()).refreshLocale(this, false);
        super.onCreate(savedInstanceState);

        // Enable if you use AppCompat 24.1.x.
//        Fixes.updateLayoutInflaterFactory(getLayoutInflater());

        setContentView(R.layout.activity_settings);

        mReplaceFragmentStrategy = new PreferenceScreenNavigationStrategy
                .ReplaceFragment(this,
                R.anim.abc_fade_in,
                R.anim.abc_fade_out,
                R.anim.abc_fade_in,
                R.anim.abc_fade_out);

        if (savedInstanceState == null) {
            mSettingsFragment = SettingsFragment.newInstance(null);
            getSupportFragmentManager().beginTransaction().add(R.id.content, mSettingsFragment, "Settings").commit();
        } else {
            mSettingsFragment = (SettingsFragment) getSupportFragmentManager().findFragmentByTag("Settings");
        }

        getSupportFragmentManager().addOnBackStackChangedListener(this);

        mToolbar = findViewById(R.id.toolbar);
        setSupportActionBar(mToolbar);
        ActionBar ab = getSupportActionBar();


        // Cross-fading title setup.
        mTitle = getTitle();

        mTitleSwitcher = new TextSwitcher(mToolbar.getContext());
        mTitleSwitcher.setFactory(() -> {
            TextView tv = new AppCompatTextView(mToolbar.getContext());
            TextViewCompat.setTextAppearance(tv, R.style.TextAppearance_AppCompat_Widget_ActionBar_Title);
            return tv;
        });
        mTitleSwitcher.setCurrentText(mTitle);
        if (ab != null) {
            ab.setDisplayHomeAsUpEnabled(true);
            ab.setCustomView(mTitleSwitcher);
            ab.setDisplayShowCustomEnabled(true);
            ab.setDisplayShowTitleEnabled(false);
        }


        // Add to hierarchy before accessing layout params.
        int margin = Util.dpToPxOffset(this, 16);
        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) mTitleSwitcher.getLayoutParams();
        lp.leftMargin = margin;
        lp.rightMargin = margin;

        mTitleSwitcher.setInAnimation(this, R.anim.abc_fade_in);
        mTitleSwitcher.setOutAnimation(this, R.anim.abc_fade_out);
    }
 
开发者ID:fekracomputers,项目名称:IslamicLibraryAndroid,代码行数:59,代码来源:SettingsActivity.java

示例14: onCreate

import android.widget.TextSwitcher; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setBackgroundDrawable(null);
    setContentView(R.layout.main);

    
    mFormatUtil = new FormatUtil(this);
    
    HandlerThread pThread = new HandlerThread(TAG);
    pThread.setPriority(Thread.MIN_PRIORITY);
    pThread.start();
    pHandler = new Handler(pThread.getLooper());


    locText = (TextSwitcher) findViewById(R.id.text_location);
    locText.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            return getLayoutInflater()
                    .inflate(R.layout.coordinations, null).findViewById(
                            R.id.text);
        }

    });


    locText.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            mFormatUtil.toggleFormat();
            setLocText(mPin.mPoint, true);
        }
    });


    mMapView = (MapView) findViewById(R.id.mapview);
    mMapView.setBuiltInZoomControls(true);
    mPin = new AndroidPin(this);
    Intent intent = getIntent();
    mPin.setPosition(mMapView.getMapCenter());


    fallOverlay = new FallInOverlay(mMapView);
    fallOverlay.setOnEndListener(new OnEndListener() {
        @Override
        public void onEnd() {
            mMapView.getOverlays().remove(fallOverlay);
            mMapView.getOverlays().add(dragOverlay);
        }
    });

    dragOverlay = new DragableOverlay(mPin, mMapView);
    dragOverlay.setOnLocationChangeListener(new OnLocationChangeListener() {
        @Override
        public void onChage(GeoPoint gp) {
            setLocText(gp, false);
        }
    });

    mMyLocationOverlay = new MyLocationOverlay(this, mMapView);

    mMapView.getOverlays().add(mMyLocationOverlay);
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    setLocText(mPin.mPoint, false);

    mMapView.getOverlays().add(fallOverlay);
    isCreate = true;

}
 
开发者ID:misgod,项目名称:geopicker,代码行数:73,代码来源:GeoPickerActivity.java

示例15: initListView

import android.widget.TextSwitcher; //导入方法依赖的package包/类
private void initListView() {
	listView = (ListView) rootView.findViewById(R.id.lv_missiles);
	txtEmpty = (TextView) rootView.findViewById(R.id.tvEmpty);
	mViewMissileAdapter = new ViewMissileAdapter(getActivity());
	listView.setAdapter(mViewMissileAdapter);
	pagination = new Pagination(listView, mViewMissileAdapter, mUrl, this);
	listView.setOnScrollListener(pagination);
	listView.setOnItemClickListener(listener);
	tvHotMissile = (TextSwitcher) rootView.findViewById(R.id.tvHotMissile);

	mHeaderView = (LinearLayout) rootView.findViewById(R.id.header);
	// Set the ViewFactory of the TextSwitcher that will create TextView
	// object when asked
	tvHotMissile.setFactory(new ViewFactory() {

		public View makeView() {
			TextView myText = (TextView) getActivity().getLayoutInflater()
					.inflate(R.layout.custom_text_view, null);
			return myText;
		}
	});
	// Declare the in and out animations and initialize them
	Animation in = AnimationUtils.loadAnimation(getActivity(),
			android.R.anim.slide_in_left);
	Animation out = AnimationUtils.loadAnimation(getActivity(),
			android.R.anim.slide_out_right);

	// set the animation type of textSwitcher
	tvHotMissile.setInAnimation(in);
	tvHotMissile.setOutAnimation(out);

	handler = new Handler();
	delaySearchHandler = new Handler() {
		@Override
		public void handleMessage(Message msg) {
			if (msg.what == 5) {
				search((String) msg.obj);

			}
		}
	};
	// called for listing special missiles like tags, disable header
	if (!isViewAllMissiles)
		mHeaderView.setVisibility(View.GONE);
	else {
		if (isSearchEnabled) {
			mHeaderView.setVisibility(View.GONE);
		} else {
			mHeaderView.setOnClickListener(new OnClickListener() {

				@Override
				public void onClick(View v) {
					MissileFragment missileFragment = new MissileFragment();
					Bundle bundle = new Bundle();
					bundle.putParcelable("missile",
							(Missile) tvHotMissile.getTag());
					missileFragment.setArguments(bundle);
					StartModule.addFragmentForModule(getFragmentManager(),
							missileFragment);
				}
			});
		}
	}
}
 
开发者ID:yajnesh,项目名称:missile-android,代码行数:65,代码来源:ViewMissilesFragment.java


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