比较炫丽的幻灯片

一个开源项目欢迎,分享给大家

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:coverflow="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/darker_gray"
    tools:context="it.moondroid.carousellayoutdemo.CoverFlowActivity">

    <it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow
        android:id="@+id/coverflow"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        coverflow:coverHeight="@dimen/cover_height"
        coverflow:coverWidth="@dimen/cover_width"
        coverflow:maxScaleFactor="1.5"
        coverflow:reflectionGap="0px"
        coverflow:rotationThreshold="0.5"
        coverflow:scalingThreshold="0.5"
        coverflow:spacing="0.6" />

    <TextSwitcher
        android:id="@+id/title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingBottom="16dp"
        android:layout_alignParentBottom="true"
        android:layout_centerVertical="true" />

</RelativeLayout>
package it.moondroid.coverflowdemo;

import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.AdapterView;
import android.widget.TextSwitcher;
import android.widget.TextView;
import android.widget.Toast;
import android.widget.ViewSwitcher;

import java.util.ArrayList;

import it.moondroid.coverflow.components.ui.containers.FeatureCoverFlow;

public class CoverFlowActivity extends Activity {

    private FeatureCoverFlow mCoverFlow;
    private CoverFlowAdapter mAdapter;
    private ArrayList<GameEntity> mData = new ArrayList<>(0);
    private TextSwitcher mTitle;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_coverflow);

        mData.add(new GameEntity(R.drawable.image_1, R.string.title1));
        mData.add(new GameEntity(R.drawable.image_2, R.string.title2));
        mData.add(new GameEntity(R.drawable.image_3, R.string.title3));
        mData.add(new GameEntity(R.drawable.image_4, R.string.title4));

        mTitle = (TextSwitcher) findViewById(R.id.title);
        mTitle.setFactory(new ViewSwitcher.ViewFactory() {
            @Override
            public View makeView() {
                LayoutInflater inflater = LayoutInflater.from(CoverFlowActivity.this);
                TextView textView = (TextView) inflater.inflate(R.layout.item_title, null);
                return textView;
            }
        });
        Animation in = AnimationUtils.loadAnimation(this, R.anim.slide_in_top);
        Animation out = AnimationUtils.loadAnimation(this, R.anim.slide_out_bottom);
        mTitle.setInAnimation(in);
        mTitle.setOutAnimation(out);

        mAdapter = new CoverFlowAdapter(this);
        mAdapter.setData(mData);
        mCoverFlow = (FeatureCoverFlow) findViewById(R.id.coverflow);
        mCoverFlow.setAdapter(mAdapter);

        mCoverFlow.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                Toast.makeText(CoverFlowActivity.this,
                        getResources().getString(mData.get(position).titleResId),
                        Toast.LENGTH_SHORT).show();
            }
        });

        mCoverFlow.setOnScrollPositionListener(new FeatureCoverFlow.OnScrollPositionListener() {
            @Override
            public void onScrolledToPosition(int position) {
                mTitle.setText(getResources().getString(mData.get(position).titleResId));
            }

            @Override
            public void onScrolling() {
                mTitle.setText("");
            }
        });

    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_coverflow_activity, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}

代码下载:

http://download.csdn.net/detail/jingwen3699/8937523

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-08-02 01:31:40

比较炫丽的幻灯片的相关文章

比較炫丽的幻灯片

一个开源项目欢迎.分享给大家 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:coverflow="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="

将ppt幻灯片转为Word文档的简单应用

工作之后你就会明白做好ppt的重要性,因为工作中需要制作ppt的时候很多.有时候我们也会遇到要将ppt转换成word的时候, PPT幻灯片文件的应用特别广泛,上学时老师上课会用它辅助讲解,上班后会议室的老板会用它展示他想表达的关键词.同时,不仅可以在计算机上进行演示,也可以在投影仪上演示,也可以把演示文稿打印出来,制作成胶片.如果我们需要将PPT转换成Word,该怎么转换呢? 下面就和大家简单说说转换的步骤. 1.先下载一个pdf转换器,打开下载好的软件,在主页面的左侧需要选择文件类型,这里我们

如何利用CSS3实现完备的幻灯片(1)

概述:我所谓完备的幻灯片,乃指满足下列条件的页面效果: 1.包含左右箭头: 2.左右箭头能无限点击,产生无限循环切换的效果: 2.图片具有滑动效果: 3.包含与图片一一对应,用以切换的选项块: 4.选项块拥有两个状态,其一为普通,其二为「当前」,后者反映其自身与当前显示区的图片具有对应关系,该对应关系必须随时有效: 5.图片自动播放,并无限循环: 6.鼠标进入图片时,图片暂停播放: 7.鼠标离开图片时,图片按当前顺序继续播放,无限循环. 如上,它完备,未必完美. 本着循序渐进的原则,我先从利用c

VIJOS PID221 / 烦人的幻灯片

 暴力出奇迹,古人诚不欺我. PID221 / 烦人的幻灯片 2017-04-14 19:47:08 运行耗时:30 ms 运行内存:12292 KB 查看最后一次评测记录 题目描述 李教授于今天下午做一个非常重要的演讲.不幸的是他不是一个非常爱整洁的人,他把自己做演讲要用的幻灯片随便堆放在一起.因此,演讲之前他不得不去整理这些幻灯片.做为一个讲求效率的学者,他希望尽可能简单地完成它.情况是这样,教授这次演讲一共要用n张幻灯片(n<=26),这n张幻灯片按照演讲要使用的顺序已经用数字1,2,-,

图片的幻灯片效果

简单实现图片的幻灯片效果 设置-->"上一页"和"下一页"按钮 NSUInteger select; //创建图片视图控件 v1=[[UIImageView alloc] initWithFrame:CGRectMake(10, 30, 400, 400)]; select=0; v1.image=arr[select]; //添加到视图 [self.view addSubview:v1]; //按钮的响应方法 -(void)butaction:(UIButt

4W1T教程1 如何使用幻灯片

第一步,读取类别为xxXX前五张幻灯片 <!-- 幻灯片循环开始-->{section name=banner loop=$banner} <li data-transition="parallaxvertical"> <img src="./uploadfile/{$qid}/guangg/{$banner[banner].LogoPic}" width="1920" height="705"

带预览效果的幻灯片

正在做一个带预览效果的幻灯片. 首先,要分析整个效果.采用VCD分析法(V;view; C: contral; D:data). 先观察整个效果图,将效果图划分为不同的块级.画出结构分析图,设置每个大块的类名. 分析要使用的数据. 进行代码开发:1, 视觉效果开发: HTML + CSS; 2, 动画效果: javascript; HTML页面编写,先架好结构,并用css样式来使页面变成要展示的样子.(以前总是看着图,事无巨细的一层层写下来,并一小块一小块的去做好样式设置,发现这样不仅浪费时间,

怎样做出优秀的扁平化设计风格 PPT 或 Keynote 幻灯片演示文稿?

怎样做出优秀的扁平化设计风格 PPT 或 Keynote 幻灯片演示文稿? http://www.zhihu.com/question/21274267/answer/62857878

自动播放——幻灯片缓冲效果&amp;&amp;带Loading效果的图片切换&amp;&amp;移动效果(按轨迹移动)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-