本文整理汇总了Java中android.widget.ViewSwitcher.setDisplayedChild方法的典型用法代码示例。如果您正苦于以下问题:Java ViewSwitcher.setDisplayedChild方法的具体用法?Java ViewSwitcher.setDisplayedChild怎么用?Java ViewSwitcher.setDisplayedChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.ViewSwitcher
的用法示例。
在下文中一共展示了ViewSwitcher.setDisplayedChild方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listSelected
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
private void listSelected(ListDesc list, boolean animate)
{
//Log.v(L.TAG, "SimplyDoActivity.listSelected() called on list " + list.getId());
setTitle(list.getLabel());
dataViewer.setSelectedList(list);
itemListSorter.sort(dataViewer.getItemData());
itemPropertiesAdapter.notifyDataSetChanged();
ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher);
if(animate)
{
viewSwitch.showNext();
}
else
{
viewSwitch.reset();
viewSwitch.setAnimateFirstView(false);
viewSwitch.setDisplayedChild(1);
}
}
示例2: AbsImageListViewItem
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
public AbsImageListViewItem(Context context, int layoutID, int imageviewID, int switcherID, ScrollSpeedAdapter adapter) {
super(context);
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.inflate(layoutID, this, true);
mImageView = (ImageView) findViewById(imageviewID);
mSwitcher = (ViewSwitcher) findViewById(switcherID);
mHolder = new AsyncLoader.CoverViewHolder();
mHolder.coverLoadable = this;
mHolder.mAdapter = adapter;
mHolder.imageDimension = new Pair<>(0,0);
mCoverDone = false;
if ( null != mImageView && null != mSwitcher) {
mSwitcher.setOutAnimation(null);
mSwitcher.setInAnimation(null);
mImageView.setImageDrawable(null);
mSwitcher.setDisplayedChild(0);
mSwitcher.setOutAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_out));
mSwitcher.setInAnimation(AnimationUtils.loadAnimation(getContext(), android.R.anim.fade_in));
}
}
示例3: onCreate
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
applyTheme();
if (getSupportActionBar() != null)
getSupportActionBar().setElevation(0);
setContentView(R.layout.style_horizontal_tabs);
init();
mTabs = (HorizontalScrollView) findViewById(R.id.steps);
mStepTabs = (LinearLayout) mTabs.findViewById(R.id.stepTabs);
mSwitch = (ViewSwitcher) findViewById(R.id.stepSwitcher);
mError = (TextView) findViewById(R.id.stepError);
mPreviousButton = (TextView) findViewById(R.id.stepPrev);
mContinue = (Button) findViewById(R.id.continueButton);
mContinue.setTextColor(primaryColor);
mContinue.setOnClickListener(this);
mSwitch.setDisplayedChild(0);
mSwitch.setInAnimation(TabStepper.this, R.anim.in_from_bottom);
mSwitch.setOutAnimation(TabStepper.this, R.anim.out_to_bottom);
mLinearity = new LinearityChecker(mSteps.total());
if (!showPrevButton)
mPreviousButton.setVisibility(View.GONE);
mPreviousButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onPrevious();
}
});
onUpdate();
}
示例4: switchWithoutAnimation
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
private void switchWithoutAnimation(ViewSwitcher switcher) {
if (switcher.getDisplayedChild() != 0) {
Animation in = switcher.getInAnimation();
Animation out = switcher.getOutAnimation();
switcher.setInAnimation(null);
switcher.setOutAnimation(null);
switcher.setDisplayedChild(0);
switcher.setInAnimation(in);
switcher.setOutAnimation(out);
};
}
示例5: Console
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
public Console(Activity activity, Bundle inState, int testMode,
ListView listView, ViewSwitcher switcher) {
mActivity = activity;
mTestMode = testMode;
mListView = listView;
// persistent data in shared prefs
SharedPreferences ss = activity.getSharedPreferences("prefs", Context.MODE_PRIVATE);
mEditor = ss.edit();
mHandler = new Handler();
mMsgAdapter = new MessageAdapter(activity.getLayoutInflater(), inState, this);
listView.setAdapter(mMsgAdapter);
mSwitcher = switcher;
if (switcher != null) {
if (activity.getResources().getConfiguration().orientation ==
Configuration.ORIENTATION_LANDSCAPE) {
// in landscape, switch to console messages and disable switching
switcher.setDisplayedChild(VIEW_MESSAGES);
mSwitcher = null;
} else {
if (mMsgAdapter.getCount() > 0) {
switcher.setDisplayedChild(VIEW_MESSAGES);
}
}
}
}
示例6: recycleViewSwitcher
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
private void recycleViewSwitcher(ViewSwitcher viewSwitcher) {
//disable animation for immediately and undetectable switching to zero child:
viewSwitcher.clearAnimation();
viewSwitcher.setInAnimation(null);
viewSwitcher.setOutAnimation(null);
viewSwitcher.setDisplayedChild(0);
}
示例7: showCard
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
protected void showCard(int cardID)
{
currentCard = db.queryForCard(cardID);
if (currentCard == null)
{
Toast.makeText(getApplicationContext(), "No such card", Toast.LENGTH_LONG).show();
ViewSwitcher vs = (ViewSwitcher) findViewById(R.id.vs_welcome);
vs.setDisplayedChild(0);
return;
}
do_actualDisplay();
}
示例8: BaseSearchWidget
import android.widget.ViewSwitcher; //导入方法依赖的package包/类
public BaseSearchWidget(Context context, final int spanCount, int orientation, boolean autoSearchEnabled, @ResultView.ResultViewSize int resultViewSize,
WidgetDisplayOptions options, SearchResultAdapter.ImageLoader imageLoader) {
super(context);
inflate(getContext(), R.layout.imoji_base_widget, this);
this.context = context;
this.options = options;
this.searchHandler = new SearchHandler(autoSearchEnabled) {
@Override
public void onSearchCompleted(List<SearchResult> newResults, int dividerPosition, boolean isRecents) {
repopulateAdapter(newResults, dividerPosition, isRecents);
}
@Override
public void beforeSearchStarted() {
switcher.setDisplayedChild(0);
}
@Override
public void onHistoryChanged() {
updateText();
}
};
switcher = (ViewSwitcher) this.findViewById(R.id.widget_switcher);
recyclerView = (RecyclerView) this.findViewById(R.id.widget_recycler);
searchBarLayout = (SearchBarLayout) this.findViewById(R.id.widget_search);
searchBarLayout.setImojiSearchListener(this);
searchBarLayout.setActionButtonsVisibility(options.isIncludeRecentsAndCreate());
resultAdapter = new SearchResultAdapter(context, imageLoader, resultViewSize, orientation, options);
resultAdapter.setSearchTapListener(this);
gridLayoutManager = new GridLayoutManager(context, spanCount, orientation, false);
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
switch (resultAdapter.getItemViewType(position)) {
case SearchResultAdapter.DIVIDER_VIEW_TYPE:
return spanCount;
default:
return 1;
}
}
});
recyclerView.setLayoutManager(gridLayoutManager);
recyclerView.setHasFixedSize(true);
recyclerView.setItemAnimator(null);
recyclerView.setAdapter(resultAdapter);
searchHandler.searchTrending(context);
imojiCreatedReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
searchHandler.searchRecents(context);
searchBarLayout.showRecentsView();
LocalBroadcastManager.getInstance(context).unregisterReceiver(this);
}
};
}