本文整理汇总了Java中android.widget.ViewAnimator类的典型用法代码示例。如果您正苦于以下问题:Java ViewAnimator类的具体用法?Java ViewAnimator怎么用?Java ViewAnimator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ViewAnimator类属于android.widget包,在下文中一共展示了ViewAnimator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOptionsItemSelected
import android.widget.ViewAnimator; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case R.id.menu_toggle_log:
mLogShown = !mLogShown;
ViewAnimator output = (ViewAnimator) findViewById(R.id.sample_output);
if (mLogShown) {
output.setDisplayedChild(1);
} else {
output.setDisplayedChild(0);
}
supportInvalidateOptionsMenu();
return true;
}
return super.onOptionsItemSelected(item);
}
示例2: onCreate
import android.widget.ViewAnimator; //导入依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sample_gallery_activity);
animator = (ViewAnimator) findViewById(R.id.animator);
imageView = (ImageView) findViewById(R.id.image);
findViewById(R.id.go).setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View view) {
Intent gallery = new Intent(ACTION_PICK, EXTERNAL_CONTENT_URI);
startActivityForResult(gallery, GALLERY_REQUEST);
}
});
if (savedInstanceState != null) {
image = savedInstanceState.getString(KEY_IMAGE);
if (image != null) {
loadImage();
}
}
}
示例3: newList
import android.widget.ViewAnimator; //导入依赖的package包/类
private View newList(
final PickerQuery q, final ViewAnimator flip,
AdapterView.OnItemClickListener click) {
final View list = newList(q, click);
list.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK &&
event.getAction() == KeyEvent.ACTION_UP) {
flip.setInAnimation(getContext(), R.anim.slide_in_left);
flip.setOutAnimation(getContext(), R.anim.slide_out_right);
flip.showPrevious();
flip.removeView(list);
flip.setInAnimation(getContext(), R.anim.slide_in_right);
flip.setOutAnimation(getContext(), R.anim.slide_out_left);
return true;
}
return false;
}
});
return list;
}
示例4: onCreateView
import android.widget.ViewAnimator; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.display_options_popup, container);
final ViewAnimator viewAnimator = v.findViewById(R.id.settings_view_container);
viewAnimator.setDisplayedChild(mCurrentView);
Window window = getDialog().getWindow();
if (window != null) {
window.setGravity(Gravity.TOP | Gravity.END);
// window.setDimAmount(0);
window.clearFlags(WindowManager.LayoutParams.FLAG_DIM_BEHIND);
//getActivity().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
//window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
return v;
}
示例5: setupViews
import android.widget.ViewAnimator; //导入依赖的package包/类
private void setupViews() {
mContainer = (ViewGroup) findViewById(R.id.container_photo);
mSwitcher = (ViewAnimator) findViewById(R.id.switcher_menu);
mPhotoView = (ImageView) findViewById(R.id.image_photo);
mPhotoTitle = (TextView) findViewById(R.id.caption_title);
mPhotoDate = (TextView) findViewById(R.id.caption_date);
findViewById(R.id.menu_back).setOnClickListener(this);
findViewById(R.id.menu_set).setOnClickListener(this);
mPhotoTitle.setText(mPhoto.getTitle());
mPhotoDate.setText(mPhoto.getDate());
mContainer.setVisibility(View.INVISIBLE);
// Sets up a view tree observer. The photo will be scaled using the size
// of one of our views so we must wait for the first layout pass to be
// done to make sure we have the correct size.
mContainer.getViewTreeObserver().addOnGlobalLayoutListener(this);
}
示例6: setupViews
import android.widget.ViewAnimator; //导入依赖的package包/类
private void setupViews() {
mInflater = LayoutInflater.from(PhotostreamActivity.this);
mNextAnimation = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_slide_next);
mBackAnimation = AnimationUtils.loadLayoutAnimation(this, R.anim.layout_slide_back);
mSwitcher = (ViewAnimator) findViewById(R.id.switcher_menu);
mMenuNext = findViewById(R.id.menu_next);
mMenuBack = findViewById(R.id.menu_back);
mMenuSeparator = findViewById(R.id.menu_separator);
mGrid = (GridLayout) findViewById(R.id.grid_photos);
mMenuNext.setOnClickListener(this);
mMenuBack.setOnClickListener(this);
mMenuBack.setVisibility(View.GONE);
mMenuSeparator.setVisibility(View.GONE);
mGrid.setClipToPadding(false);
}
示例7: flipTransition
import android.widget.ViewAnimator; //导入依赖的package包/类
/**
* Flip to the next view of the {@code ViewAnimator}'s subviews. A call to this method will
* initiate a {@link FlipAnimation} to show the next View.
* If the currently visible view is the last view, flip direction will be reversed for this
* transition.
*
* @param viewAnimator the {@code ViewAnimator}
* @param dir the direction of flip
* @param duration the transition duration in milliseconds
*/
public static void flipTransition(final ViewAnimator viewAnimator, FlipDirection dir,
long duration) {
final View fromView = viewAnimator.getCurrentView();
final int currentIndex = viewAnimator.getDisplayedChild();
final int nextIndex = (currentIndex + 1) % viewAnimator.getChildCount();
final View toView = viewAnimator.getChildAt(nextIndex);
Animation[] animc = AnimationFactory.flipAnimation(fromView, toView,
(nextIndex < currentIndex ? dir.theOtherDirection() : dir), duration, null);
viewAnimator.setOutAnimation(animc[0]);
viewAnimator.setInAnimation(animc[1]);
viewAnimator.showNext();
}
示例8: c
import android.widget.ViewAnimator; //导入依赖的package包/类
public final Dialog c(Bundle paramBundle)
{
un localun = new un(this.ad);
View localView = LayoutInflater.from(this.ad).inflate(efj.YN, null, false);
this.ai = ((ViewAnimator)localView.findViewById(efj.YI));
this.aj = ((RadioGroup)localView.findViewById(efj.YH));
this.Z = new TextView(this.ad);
int i = this.ai.getPaddingLeft();
this.Z.setPadding(i, i, i, i);
this.Z.setTextAppearance(this.ad, aaw.qG);
TextView localTextView = this.Z;
localun.a.f = localTextView;
localun.a(localView);
localun.a(fh.f, this);
localun.b(fh.a, this);
return localun.a();
}
示例9: makeButtonsView
import android.widget.ViewAnimator; //导入依赖的package包/类
private void makeButtonsView() {
mButtonsView = getActivity().getLayoutInflater().inflate(R.layout.buttons,null);
mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
mTopBarSwitcher.setVisibility(View.INVISIBLE);
mPageNumberView.setVisibility(View.INVISIBLE);
mInfoView.setVisibility(View.INVISIBLE);
mPageSlider.setVisibility(View.INVISIBLE);
}
示例10: makeButtonsView
import android.widget.ViewAnimator; //导入依赖的package包/类
private void makeButtonsView() {
mButtonsView = getLayoutInflater().inflate(R.layout.buttons,null);
mFilenameView = (TextView)mButtonsView.findViewById(R.id.docNameText);
mPageSlider = (SeekBar)mButtonsView.findViewById(R.id.pageSlider);
mPageNumberView = (TextView)mButtonsView.findViewById(R.id.pageNumber);
mInfoView = (TextView)mButtonsView.findViewById(R.id.info);
mSearchButton = (ImageButton)mButtonsView.findViewById(R.id.searchButton);
mReflowButton = (ImageButton)mButtonsView.findViewById(R.id.reflowButton);
mOutlineButton = (ImageButton)mButtonsView.findViewById(R.id.outlineButton);
mAnnotButton = (ImageButton)mButtonsView.findViewById(R.id.editAnnotButton);
mAnnotTypeText = (TextView)mButtonsView.findViewById(R.id.annotType);
mTopBarSwitcher = (ViewAnimator)mButtonsView.findViewById(R.id.switcher);
mSearchBack = (ImageButton)mButtonsView.findViewById(R.id.searchBack);
mSearchFwd = (ImageButton)mButtonsView.findViewById(R.id.searchForward);
mSearchText = (EditText)mButtonsView.findViewById(R.id.searchText);
mLinkButton = (ImageButton)mButtonsView.findViewById(R.id.linkButton);
mMoreButton = (ImageButton)mButtonsView.findViewById(R.id.moreButton);
mTopBarSwitcher.setVisibility(View.INVISIBLE);
mPageNumberView.setVisibility(View.INVISIBLE);
mInfoView.setVisibility(View.INVISIBLE);
mPageSlider.setVisibility(View.INVISIBLE);
}
示例11: initFlipCard
import android.widget.ViewAnimator; //导入依赖的package包/类
private void initFlipCard() {
viewAnimator = (ViewAnimator) this.findViewById(R.id.viewFlipper);
cardFront = LayoutInflater.from(this).inflate(R.layout.card, null);
cardBack = LayoutInflater.from(this).inflate(R.layout.card, null);
viewAnimator.addView(cardFront);
viewAnimator.addView(cardBack);
currentCard = cardFront;
viewAnimator.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
flipCard();
updateNavBar();
}
});
}
示例12: switchView
import android.widget.ViewAnimator; //导入依赖的package包/类
@UiThread
void switchView(View parentView, int showView) {
if (parentView == null)
return;
FilesListAdapter.ViewHolder holder = (FilesListAdapter.ViewHolder) parentView.getTag();
ViewAnimator viewAnimator = holder.animator;
viewAnimator.setInAnimation(context, R.anim.slide_down);
int viewIndex = 0;
switch (showView) {
case R.id.dataLayout:
viewIndex = 0;
break;
case R.id.DecryptLayout:
viewIndex = 1;
break;
}
viewAnimator.setDisplayedChild(viewIndex);
holder.page = viewIndex;
}
示例13: switchView
import android.widget.ViewAnimator; //导入依赖的package包/类
void switchView(final View frame, final int showView) {
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
if (frame == null) {
return;
}
FilesListAdapter.ViewHolder holder = (FilesListAdapter.ViewHolder) frame.getTag();
ViewAnimator viewAnimator = holder.animator;
int viewIndex = 0;
switch (showView) {
case R.id.dataLayout:
viewIndex = 0;
break;
case R.id.DecryptLayout:
viewIndex = 1;
break;
}
viewAnimator.setDisplayedChild(viewIndex);
viewAnimator.setInAnimation(null);
holder.page = viewIndex;
}
});
}
示例14: onCreate
import android.widget.ViewAnimator; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_PROGRESS);
getWindow().setFeatureInt(Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
setContentView(
getLayoutInflater().inflate(R.layout.main, null));
this.viewAnimator = (ViewAnimator) findViewById(R.id.mainViewAnimatorLayout);
this.myWebView = new MyWebView(this);
this.myMenu = new MyMenu(this, myWebView, viewAnimator);
viewAnimator.addView(myWebView);
viewAnimator.addView(
getLayoutInflater().inflate(R.layout.web_source, null));
if(!startActivityFromWidget(getIntent())){
startActivity();
}
}
示例15: MyMenu
import android.widget.ViewAnimator; //导入依赖的package包/类
public MyMenu(NavBroActivity navAppActivity, MyWebView myWebView, ViewAnimator viewAnimator) {
this.navAppActivity = navAppActivity;
this.myWebView = myWebView;
this.viewAnimator = viewAnimator;
this.slidingMenu = new SlidingMenu(navAppActivity);
slidingMenu.setMode(SlidingMenu.LEFT);
slidingMenu.setTouchModeAbove(SlidingMenu.TOUCHMODE_NONE);
slidingMenu.setShadowWidthRes(R.dimen.shadow_width);
slidingMenu.setShadowDrawable(R.drawable.my_menu_shadow);
slidingMenu.setBehindOffsetRes(R.dimen.slidingmenu_offset);
slidingMenu.setFadeDegree(0.35f);
slidingMenu.attachToActivity(navAppActivity, SlidingMenu.SLIDING_CONTENT);
slidingMenu.setMenu(R.layout.left_menu);
this.view = slidingMenu.getMenu();
setEventOnClickButton();
setWebViewSettings();
}