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


Java ViewSwitcher类代码示例

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


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

示例1: textSwiter

import android.widget.ViewSwitcher; //导入依赖的package包/类
private void textSwiter() {
    textSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            return (TextView) LayoutInflater.from(CreateActivity.this).inflate(R.layout.item_textswitcher, null);
        }
    });

    Observable.interval(1, 1, TimeUnit.SECONDS)
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new Consumer<Long>() {
                @Override
                public void accept(Long aLong) throws Exception {
                    textSwitcher.setText("随机数 : " + aLong);
                }
            });
}
 
开发者ID:penghuanliang,项目名称:Rxjava2.0Demo,代码行数:18,代码来源:CreateActivity.java

示例2: initViews

import android.widget.ViewSwitcher; //导入依赖的package包/类
public void initViews() {
    flRootView = (FrameLayout) activity.findViewById(R.id.play_root);
    isBg = (ImageSwitcher) activity.findViewById(R.id.play_bg);

    isBg.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            ImageView view = new ImageView(activity);
            view.setLayoutParams(new FrameLayout.LayoutParams(
                    FrameLayout.LayoutParams.MATCH_PARENT,
                    FrameLayout.LayoutParams.MATCH_PARENT));
            view.setScaleType(ImageView.ScaleType.CENTER_CROP);
            return view;
        }
    });
}
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:17,代码来源:PlayBgDrawableController.java

示例3: initViews

import android.widget.ViewSwitcher; //导入依赖的package包/类
private void initViews() {

        albumView = (ImageSwitcher) view.findViewById(R.id.play_album_is);
        albumView.setFactory(new ViewSwitcher.ViewFactory() {
            @Override
            public View makeView() {
                ImageView imageView = new ImageView(getActivity());
                imageView.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT));
                imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
                int pad = (int) getActivity().getResources().getDimension(R.dimen.play_album_padding);
                imageView.setPadding(pad, pad, pad, pad);
                return imageView;
            }
        });

        DisplayMetrics metrics = Utils.getMetrics(getActivity());
        //专辑图片直径
        int size = metrics.widthPixels * 2 / 3;
        albumPictureController = new AlbumPictureController(getActivity(), albumView, size);

    }
 
开发者ID:DuanJiaNing,项目名称:Musicoco,代码行数:22,代码来源:VisualizerFragment.java

示例4: initViews

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override
protected void initViews(Bundle savedInstanceState) {
    setDisplayHomeAsUpEnabled(true);
    tvVersion = (TextView) findViewById(R.id.tv_app_version);
    tvVersion.setText("v" + BuildConfig.VERSION_NAME);
    imageSwitcher = (ImageSwitcher) findViewById(R.id.imageSwitcher);
    imageSwitcher.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public View makeView() {
            ImageView imageView = new ImageView(AboutActivity.this);
            imageView.setScaleType(ImageView.ScaleType.FIT_XY);
            return imageView;
        }
    });
    imageSwitcher.setInAnimation(AnimationUtils.loadAnimation(this,
            R.anim.zoom_in));
    imageSwitcher.setOutAnimation(AnimationUtils.loadAnimation(this,
            R.anim.zoom_out));
}
 
开发者ID:li-yu,项目名称:FakeWeather,代码行数:20,代码来源:AboutActivity.java

示例5: onBackPressed

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override
public void onBackPressed()
{
    Log.v(L.TAG, "SimplyDoActivity.onBackPressed() called");
    
    ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher);
    int displayed = viewSwitch.getDisplayedChild();
    
    if(displayed == 0)
    {
        super.onBackPressed();
    }
    else
    {
        setTitle(R.string.app_name);
        viewSwitch.showPrevious();
        dataViewer.setSelectedList(null);
        itemPropertiesAdapter.notifyDataSetChanged();
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:21,代码来源:SimplyDoActivity.java

示例6: onPrepareOptionsMenu

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override
public boolean onPrepareOptionsMenu(Menu menu)
{
    Log.v(L.TAG, "SimplyDoActivity.onPrepareOptionsMenu() called");
    
    menu.clear();
    ViewSwitcher viewSwitch = (ViewSwitcher)findViewById(R.id.ListsItemsSwitcher);
    boolean isItemDisplay = viewSwitch.getDisplayedChild() != 0;
    
    if(isItemDisplay)
    {
        MenuItem deleteInactiveMI = menu.add(Menu.NONE, DELETE_INACTIVE, Menu.NONE, "Delete Inactive");
        deleteInactiveMI.setIcon(android.R.drawable.ic_menu_delete);
    }
    
    MenuItem settingsMI = menu.add(Menu.NONE, SETTINGS, Menu.NONE, "Settings");
    settingsMI.setIcon(android.R.drawable.ic_menu_preferences);
    
    if(isItemDisplay)
    {
        MenuItem sortNowMI = menu.add(Menu.NONE, SORT_NOW, Menu.NONE, "Sort Now");
        sortNowMI.setIcon(android.R.drawable.ic_menu_sort_by_size);
    }
    
    return true;
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:27,代码来源:SimplyDoActivity.java

示例7: 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);
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:24,代码来源:SimplyDoActivity.java

示例8: PinView

import android.widget.ViewSwitcher; //导入依赖的package包/类
public PinView(Context context, PinListener listener, String pin, int layoutId) {
       this.context = context;
	this.listener = listener;
	this.confirmPin = pin == null;
	this.pin1 = pin;
	LayoutInflater layoutInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	v = layoutInflater.inflate(layoutId, null);
	for (int id : buttons) {
		v.findViewById(id).setOnClickListener(this);
	}
	result = (TextView)v.findViewById(R.id.result1);		
	switcher = (ViewSwitcher)v.findViewById(R.id.switcher);  
	switcher.setInAnimation(inFromRightAnimation());
	switcher.setOutAnimation(outToLeftAnimation());		
	try {
		digest = MessageDigest.getInstance("SHA-1");
	} catch (NoSuchAlgorithmException e) {
		throw new RuntimeException(e);
	}
       this.vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
}
 
开发者ID:tiberiusteng,项目名称:financisto1-holo,代码行数:22,代码来源:PinView.java

示例9: renameFlow

import android.widget.ViewSwitcher; //导入依赖的package包/类
/**
 * Hides the Options Menu and uses a ViewSwitcher to quick turn the exisiting TextView with the
 * Flow's name into an EditText for the user to rename.
 *
 * @param cardPosition position of cardview in adapter
 * @param cardViewClicked the cardview view object clicked
 */
private void renameFlow(final int cardPosition, final View cardViewClicked) {
    menuState = AppConstants.MENU_ITEMS_HIDE;
    invalidateOptionsMenu();
    final ViewSwitcher switcher = (ViewSwitcher) cardViewClicked.findViewById(R.id.hub_rename_switcher);
    final EditText rename = (EditText) switcher.findViewById(R.id.hub_item_flow_rename);

    AppUtils.setNameInputFilters(rename);

    rename.setOnFocusChangeListener(new View.OnFocusChangeListener() {
        @Override
        public void onFocusChange(View v, boolean hasFocus) {
            if (rename.hasFocus()) {
                showEditPopupWindow(rename, cardViewClicked, switcher, cardPosition);
            }
        }
    });

    switcher.showNext();

    rename.requestFocus();
    /* Forces keyboard */


}
 
开发者ID:robertsimoes,项目名称:Flow,代码行数:32,代码来源:TheHubActivity.java

示例10: 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));
    }
}
 
开发者ID:gateship-one,项目名称:malp,代码行数:25,代码来源:AbsImageListViewItem.java

示例11: setupPassageSection

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

示例12: onCreateView

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
						 Bundle savedInstanceState) {
	root = (ViewSwitcher) inflater.inflate(R.layout.fragment_network,
			container, false);
	messages = (TextView) root.findViewById(R.id.loading_text);
	final View autoConnect = root.findViewById(R.id.auto_connect);
	// Auto connect service unavailable for manual calculations
	if (wifiNetwork.getScanResult() == null)
		autoConnect.setVisibility(View.GONE);
	else {
		final int level = wifiNetwork.getLevel();
	}
	if (passwordList != null)
		displayResults();
	return root;
}
 
开发者ID:yolosec,项目名称:upcKeygen,代码行数:18,代码来源:NetworkFragment.java

示例13: initView

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override protected void initView() {
    getWindow().addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
    getWindow().addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
    setUI();
    SwipeUnLockLayout swipeUnLockLayout = (SwipeUnLockLayout) findViewById(
        R.id.slide_layout);
    swipeUnLockLayout.setOnSwipeListener(this);
    mViewSwitcher = (ViewSwitcher) findViewById(R.id.lock_view_switcher);
    mTitle = (TextView) findViewById(R.id.lock_view_gank_title);
    TextView mLockViewDate = (TextView) findViewById(R.id.lock_view_date);
    final String lockDateText = DateUtil.getLockDateText();
    mLockViewDate.setText(lockDateText);
    mImg = (ImageView) findViewById(R.id.lock_view_img);
    url = PreferenceUtil.getString("url");
    if (url.isEmpty()) {
        mImg.setImageResource(R.drawable.test_image);
    } else {
       getBitmap();
    }
    mImg.setOnClickListener(new View.OnClickListener() {
        @Override public void onClick(View v) {
            mViewSwitcher.showNext();
        }
    });

}
 
开发者ID:wavever,项目名称:GankLock,代码行数:27,代码来源:LockActivity.java

示例14: onCreateView

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    final View rootView = inflater.inflate(R.layout.request, container, false);
    switcherLoad = (ViewSwitcher) rootView.findViewById(R.id.viewSwitcherLoadingMain);

    FloatingActionButton fab = (FloatingActionButton) rootView.findViewById(R.id.fab_rq);
    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            confirmSelection();
        }
    });

    if (taskList.getStatus() == AsyncTask.Status.PENDING) {
        // My AsyncTask has not started yet
        taskList.execute();
    }

    if (taskList.getStatus() == AsyncTask.Status.FINISHED) {
        // My AsyncTask is done and onPostExecute was called
        new AsyncWorkerList().execute();
    }

    return rootView;
}
 
开发者ID:OpenLauncherTeam,项目名称:openlauncher,代码行数:26,代码来源:HideAppsFragment.java

示例15: onCreate

import android.widget.ViewSwitcher; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.welcome_to_summoner_rift);
    ButterKnife.bind(this);

    mProcessTv.setInAnimation(this, R.anim.bottom_in);
    mProcessTv.setOutAnimation(this, R.anim.top_out);
    mProcessTv.setFactory(new ViewSwitcher.ViewFactory() {
        @Override
        public TextView makeView() {
            TextView textView = (TextView) LayoutInflater.from(WelcomeToSummonerRift.this)
                    .inflate(R.layout.progress_text, null);
            return textView;
        }
    });
}
 
开发者ID:VernonLee,项目名称:Theogony,代码行数:18,代码来源:WelcomeToSummonerRift.java


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