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


Java ViewFactory类代码示例

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


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

示例1: onCreate

import android.widget.ViewSwitcher.ViewFactory; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.uistudy_view_switcher);
	
	switcher = this.findViewSwitcher(R.id.viewSwitcher);
	//===给swticher设置View工厂,当调用switcher.getNextView()时,就是返回 factory.makeView()创建的View
	//===这里给一个TextView,让swticher切换多个TextView
	switcher.setFactory(new ViewFactory() {
		
		@Override
		public View makeView() {
			return new TextView(V_ViewSwitcher.this);
		}
	});	
}
 
开发者ID:cowthan,项目名称:AyoSunny,代码行数:17,代码来源:V_ViewSwitcher.java

示例2: generateDialogContent

import android.widget.ViewSwitcher.ViewFactory; //导入依赖的package包/类
private void generateDialogContent(){
	this.dialog = new Dialog((BaseActivityAbstract)this.getActivity());
	this.dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
	this.dialog.setContentView(R.layout.summary_result_dialog_layout);
	this.dialog.setCancelable(false);
	this.tryAgainDialogButton = (Button)dialog.findViewById(R.id.summary_dialog_retry_button);
	this.quitDialogButton = (Button)dialog.findViewById(R.id.summary_dialog_quit_button);
	
	final SummaryDialogDisplayTaskImpl currentSummaryDialogDisplayTaskImpl = this;
	this.earnedPointTextSwitcher = (TextSwitcher) this.dialog.findViewById(R.id.summary_point_textswitcher);
	final int textColorInt = Color.parseColor("#41A62A");
	this.earnedPointTextSwitcher.setFactory(new ViewFactory() {
		public View makeView() {
			TextView textView = new TextView(currentSummaryDialogDisplayTaskImpl.getActivity().getApplicationContext());
			textView.setGravity(Gravity.LEFT);
			textView.setTextColor(textColorInt);
			return textView;
		}
	});
	
}
 
开发者ID:benzyaa,项目名称:android_apps,代码行数:22,代码来源:SummaryDialogDisplayTaskImpl.java

示例3: onCreate

import android.widget.ViewSwitcher.ViewFactory; //导入依赖的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

示例4: initListView

import android.widget.ViewSwitcher.ViewFactory; //导入依赖的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

示例5: setHeaderFragment

import android.widget.ViewSwitcher.ViewFactory; //导入依赖的package包/类
private void setHeaderFragment() {
	Bundle bundle = this.getArguments();
	mAccountID = bundle.getLong(ACCOUNT_ID);
	// Get list items
	mAccount = mOperationHandler.getAccount(mAccountID);
	// Get Current saves
	Double currentMoney = mAccount.getMoney();
	mTxtSwitchSaves.setFactory(new ViewFactory() {

		public View makeView() {

			LayoutInflater inflater = LayoutInflater.from(mContext);

			TextView textView = (TextView) inflater.inflate(
					R.layout.text_view_switcher, null);

			return textView;

		}
	});

	// Set TextSwitch background
	int[] backgroundColor = StyleAPP.getBackgroundColor(getActivity(),
			mAccount.getIcon());
	mTxtSwitchSaves.setBackgroundColor(backgroundColor[0]);

	
	// Declare the in and out animations and initialize them
	 Animation in =
	 AnimationUtils.loadAnimation(mContext,R.anim.top_to_down_anim);
	 Animation out =
	 AnimationUtils.loadAnimation(mContext,android.R.anim.fade_out);
	
	 // set the animation type of textSwitcher
	 mTxtSwitchSaves.setInAnimation(in);
	 mTxtSwitchSaves.setOutAnimation(out);

	// Set currect Saves
	mTxtSwitchSaves.setText(Constant.DF.format(currentMoney));
	
}
 
开发者ID:coffeearmy,项目名称:piggybank,代码行数:42,代码来源:AccountFragment.java


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