切换视图代码
来源:互联网 发布:js点击隐藏显示 编辑:程序博客网 时间:2024/06/18 04:32
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: // Navigate "up" the demo structure to the launchpad activity. // See http://developer.android.com/design/patterns/navigation.html for more. NavUtils.navigateUpTo(this, new Intent(this, MainActivity.class)); return true; case R.id.action_toggle: // 只有两种状态,用boolean类型来标记两种状态 mContentLoaded = !mContentLoaded; showContentOrLoadingIndicator(mContentLoaded); return true; } return super.onOptionsItemSelected(item); } /** * 在两种视图间进行切换 */ private void showContentOrLoadingIndicator(boolean contentLoaded) { // 为showView和hideView定义初始值 final View showView = contentLoaded ? mContentView : mLoadingView; final View hideView = contentLoaded ? mLoadingView : mContentView; // Set the "show" view to 0% opacity but visible, so that it is visible // (but fully transparent) during the animation. showView.setAlpha(0f); showView.setVisibility(View.VISIBLE); // Animate the "show" view to 100% opacity, and clear any animation listener set on // the view. Remember that listeners are not limited to the specific animation // describes in the chained method calls. Listeners are set on the // ViewPropertyAnimator object for the view, which persists across several // animations. showView.animate() .alpha(1f) .setDuration(mShortAnimationDuration) .setListener(null); // Animate the "hide" view to 0% opacity. After the animation ends, set its visibility // to GONE as an optimization step (it won't participate in layout passes, etc.) hideView.animate() .alpha(0f) .setDuration(mShortAnimationDuration) .setListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { hideView.setVisibility(View.GONE); } }); }
- 切换视图代码
- IOS视图切换动画效果<代码演示>
- SharpDevelop 如何切换设计视图和代码视图
- 视图切换
- 切换视图
- 视图切换
- 视图切换
- 视图切换
- 视图切换
- 代码 实现UIDatePicker控件 和 Tab Bar 视图切换
- 【IOS学习】视图切换,纯代码实现 UITabBarController,NavigationController
- 两行代码搞定Android视图扩散切换效果
- C#.NET常见问题(FAQ)-使用SharpDevelop开发 如何切换设计视图和代码视图
- UIQ视图切换
- SDI多视图切换
- SDI 视图切换函数
- Avkon视图切换架构
- Android 视图切换效果
- 大话设计模式(通俗易懂)
- Android开源项目(7
- Android boundCenterBottom
- log4j直接在字符串中构建xml以及解析xml
- C#调用exe文件源代码
- 切换视图代码
- Python多线程检查域名是否存在
- 怎样将Windows 7变成无线路由器
- PHP连接MySQL报错:Fatal error: Call to undefined function mysql_connect()之解决方法
- 国家气象局提供的天气预报接口
- linux shell --- 条件判断
- 谈谈你对云计算技术的看法
- 反思
- android -- 蓝牙 bluetooth (三)搜索蓝牙