當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。