红米4a怎么弄虚拟按键怎么弄

PPT中多页文字或很多张图片字幕滚动效果制作_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
PPT中多页文字或很多张图片字幕滚动效果制作
上传于||文档简介
&&P​P​T​中​文​字​或​图​片​字​幕​式​滚​动​动​画​制​作​。
阅读已结束,如果下载本文需要使用1下载券
想免费下载本文?
定制HR最喜欢的简历
你可能喜欢26482人阅读
Z.移动互联(29)
自从滑动功能出来后人们都习惯手滑来滑去,现在我做了一个简单例子,实现页面之间的左右滑动。实现的方法有很多,我这里用的是Gallery加载适配器的方法。
有图有真像:
第一界面,内容差不多,只是前面的编号不一样。
一个activity&&
PageScrollActivity.java
1 package com.harlan.
3 import java.util.ArrayL
4 import java.util.L
5 import android.app.A
6 import android.os.B
7 import android.widget.G
8 import com.harlan.act.adapter.PageA
9 import com.harlan.entity.I
<span style="color:#
<span style="color:# /**
<span style="color:#
* 页面滑动
<span style="color:#
* @author Harlan Song
<span style="color:#
* @email mark_
<span style="color:#
<span style="color:# public class PageScrollActivity extends Activity {
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
public void onCreate(Bundle savedInstanceState) {
<span style="color:#
super.onCreate(savedInstanceState);
<span style="color:#
setContentView(R.layout.main);
<span style="color:#
gallery = (Gallery) findViewById(R.id.gallery1);
<span style="color:#
List&Img& list=new ArrayList&Img&();
<span style="color:#
<span style="color:#
for (int i = 1; i & 11; i&#43;&#43;) {
<span style="color:#
img=new Img();
<span style="color:#
img.setDes(i&#43;&.这种房子非常有创意,欢迎访问:
更多-精彩移动开发知识文章-分享!&);
<span style="color:#
//图片就不加载了
<span style="color:#
list.add(img);
<span style="color:#
<span style="color:#
PageAdapter pageAdapter=new PageAdapter(PageScrollActivity.this, list);
<span style="color:#
gallery.setAdapter(pageAdapter);
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:# }
gallery配置器
PageAdapter.java
1 package com.harlan.act.
3 import java.util.L
4 import android.content.C
5 import android.view.LayoutI
6 import android.view.V
7 import android.view.ViewG
8 import android.widget.BaseA
9 import android.widget.TextV
<span style="color:# import com.harlan.act.R;
<span style="color:# import com.harlan.entity.I
<span style="color:#
<span style="color:# public class PageAdapter extends BaseAdapter {
<span style="color:#
private List&Img&
<span style="color:#
<span style="color:#
public PageAdapter(Context context,List&Img& list) {
<span style="color:#
this.list=
<span style="color:#
this.inflater=LayoutInflater.from(context);
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
public int getCount() {
<span style="color:#
return list.size();
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
public Object getItem(int position) {
<span style="color:#
return list.get(position);
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
public long getItemId(int position) {
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
public View getView(int position, View convertView, ViewGroup parent) {
<span style="color:#
CacheView cacheV
<span style="color:#
if(convertView==null){
<span style="color:#
convertView=inflater.inflate(R.layout.item_page, null);
<span style="color:#
cacheView=new CacheView();
<span style="color:#
cacheView.tv_des=(TextView) convertView.findViewById(R.id.tv_des);
<span style="color:#
//cacheView.imgv_img=(ImageView) convertView.findViewById(R.id.imageView1);
<span style="color:#
convertView.setTag(cacheView);
<span style="color:#
<span style="color:#
cacheView=(CacheView) convertView.getTag();
<span style="color:#
<span style="color:#
cacheView.tv_des.setText(list.get(position).getDes());
<span style="color:#
<span style="color:#
return convertV
<span style="color:#
<span style="color:#
<span style="color:#
private static class CacheView{
<span style="color:#
TextView tv_
<span style="color:#
//ImageView imgv_
<span style="color:#
<span style="color:# }
1 package com.harlan.
* 图片实体类
* @author Harlan Song
* @email mark_
8 public class Img {
private S//描述
<span style="color:#
private S//图片路径
<span style="color:#
public String getDes() {
<span style="color:#
<span style="color:#
<span style="color:#
public void setDes(String des) {
<span style="color:#
this.des =
<span style="color:#
<span style="color:#
public String getImgurl() {
<span style="color:#
<span style="color:#
<span style="color:#
public void setImgurl(String imgurl) {
<span style="color:#
this.imgurl =
<span style="color:#
<span style="color:#
<span style="color:# }
1 &?xml version=&<span style="color:#.0& encoding=&utf-8&?&
2 &LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:orientation=&vertical& &
android:id=&@&#43;id/gallery1&
android:layout_width=&fill_parent&
<span style="color:#
android:layout_height=&fill_parent&
<span style="color:#
android:spacing=&<span style="color:#dip& /&
<span style="color:#
<span style="color:# &/LinearLayout&
item_page.xml
1 &?xml version=&<span style="color:#.0& encoding=&utf-8&?&
2 &LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:orientation=&vertical&
android:padding=&<span style="color:#dip&&
&ImageView
android:id=&@&#43;id/imageView1&
<span style="color:#
android:layout_width=&fill_parent&
<span style="color:#
android:layout_height=&wrap_content&
<span style="color:#
android:src=&@drawable/img_page&
<span style="color:#
<span style="color:#
<span style="color:#
<span style="color:#
android:id=&@&#43;id/tv_des&
<span style="color:#
android:layout_width=&wrap_content&
<span style="color:#
android:layout_height=&wrap_content&
<span style="color:#
android:text=&TextView&
<span style="color:#
<span style="color:#
<span style="color:# &/LinearLayout&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
Linux系统与内核群:
WP建站技术群:
访问:1936429次
积分:19748
积分:19748
排名:第305名
原创:339篇
转载:213篇
评论:227条
(1)(1)(2)(1)(2)(1)(2)(3)(2)(2)(1)(7)(4)(4)(2)(4)(1)(4)(1)(2)(5)(3)(8)(5)(5)(9)(4)(1)(1)(1)(1)(1)(4)(1)(1)(2)(1)(2)(9)(16)(1)(41)(68)(53)(4)(40)(53)(24)(28)(83)(7)(1)(12)(15)& & & & &&
& & & & &&
2.实现分析
(1).xml配置
&&&&android:id="@+id/container"&&
&&&&android:layout_width="match_parent"&&
&&&&android:layout_height="100dp"&&
&&&&android:clipChildren="false"&&
&&&&android:gravity="center_horizontal"&&
&&&&android:layerType="software"&&
&&&&android:orientation="horizontal"&&&
&&&&&&&&android:id="@+id/viewpager"&&
&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&android:layout_height="match_parent"&&
&&&&&&&&android:layout_marginLeft="110dp"&&
&&&&&&&&android:layout_marginRight="110dp"&&
&&&&&&&&android:clipChildren="false"&&&
(2).java代码
viewPager.setOffscreenPageLimit(3);&&&
viewPager.setPageMargin(10);&&
container.setOnTouchListener(new&View.OnTouchListener()&{&&
&&&&@Override&&
&&&&public&boolean&onTouch(View&v,&MotionEvent&event)&{&&
&&&&&&&&return&viewPager.dispatchTouchEvent(event);&&
3.代码实现
public&class&MainActivity&extends&Activity&implements&OnPageChangeListener&{&&
&&&&private&ViewPager&viewP&&
&&&&private&List&View&&views&=&new&ArrayList&View&();&&
&&&&private&LinearLayout&&&
&&&&private&TextView&tvT&&
&&&&private&LayoutInflater&&&
&&&&private&String&&&
&&&&@Override&&
&&&&protected&void&onCreate(Bundle&savedInstanceState)&{&&
&&&&&&&&super.onCreate(savedInstanceState);&&
&&&&&&&&setContentView(R.layout.activity_main);&&
&&&&&&&&inflater&=&getLayoutInflater();&&
&&&&&&&&container&=&(LinearLayout)&findViewById(R.id.container);&&
&&&&&&&&viewPager&=&(ViewPager)&findViewById(R.id.viewpager);&&
&&&&&&&&tvTitle&=&(TextView)&findViewById(R.id.title);&&
&&&&&&&&&&
&&&&&&&&dir&=&Environment.getExternalStorageDirectory().getAbsolutePath();&&
&&&&&&&&&&
&&&&&&&&views&=&new&ArrayList&View&();&&
&&&&&&&&&&
&&&&&&&&for&(int&i&=&1;&i&&=&12;&i++)&{&&
&&&&&&&&&&&&View&view&=&inflater.inflate(R.layout.guide_item,&null);&&
&&&&&&&&&&&&views.add(view);&&
&&&&&&&&}&&
&&&&&&&&&&
&&&&&&&&&&
&&&&&&&&&&
&&&&&&&&&&
&&&&&&&&viewPager.setOffscreenPageLimit(3);&&&
&&&&&&&&&&
&&&&&&&&viewPager.setPageMargin(10);&&
&&&&&&&&&&
&&&&&&&&container.setOnTouchListener(new&View.OnTouchListener()&{&&
&&&&&&&&&&&&@Override&&
&&&&&&&&&&&&public&boolean&onTouch(View&v,&MotionEvent&event)&{&&
&&&&&&&&&&&&&&&&return&viewPager.dispatchTouchEvent(event);&&
&&&&&&&&&&&&}&&
&&&&&&&&});&&
&&&&&&&&&&
&&&&&&&&viewPager.setAdapter(new&MyAdapter());&&&
&&&&&&&&viewPager.setOnPageChangeListener(this);&&
&&&&class&MyAdapter&extends&PagerAdapter&{&&
&&&&&&&&@Override&&
&&&&&&&&public&int&getCount()&{&&
&&&&&&&&&&&&return&views.size();&&
&&&&&&&&}&&
&&&&&&&&@Override&&
&&&&&&&&public&boolean&isViewFromObject(View&view,&Object&obj)&{&&
&&&&&&&&&&&&return&view&==&&&&
&&&&&&&&}&&
&&&&&&&&@Override&&
&&&&&&&&public&void&destroyItem(ViewGroup&container,&int&position,&Object&object)&{&&
&&&&&&&&&&&&container.removeView((View)&object);&&&
&&&&&&&&}&&
&&&&&&&&@Override&&
&&&&&&&&public&Object&instantiateItem(ViewGroup&container,&int&position)&{&&
&&&&&&&&&&&&System.out.println("pos:"&+&position);&&
&&&&&&&&&&&&View&view&=&views.get(position);&&
&&&&&&&&&&&&&&
&&&&&&&&&&&&ImageView&img&=&(ImageView)&view.findViewById(R.id.icon);&&
&&&&&&&&&&&&img.setImageBitmap(BitmapFactory.decodeFile(dir&+&getFile(position)));&&
&&&&&&&&&&&&container.addView(view);&&
&&&&&&&&&&&&return&views.get(position);&&&
&&&&&&&&}&&
&&&&public&void&onPageScrolled(int&position,&float&positionOffset,&int&positionOffsetPixels)&{&&
&&&&&&&&if&(viewPager&!=&null)&{&&
&&&&&&&&&&&&viewPager.invalidate();&&
&&&&&&&&}&&
&&&&public&void&onPageSelected(int&position)&{&&
&&&&&&&&tvTitle.setText(getFile(position));&&
&&&&public&void&onPageScrollStateChanged(int&state)&{&&
&&&&public&String&getFile(int&position)&{&&
&&&&&&&&return&"/img"&+&((position&+&1)&&=&10&?&(position&+&1)&:&"0"&+&(position&+&1))&+&".png";&&
&xmlns:android="/apk/res/android"&&
&&&&android:layout_width="match_parent"&&
&&&&android:layout_height="match_parent"&&
&&&&android:layout_marginLeft="15dp"&&
&&&&android:layout_marginRight="15dp"&&
&&&&android:layout_marginTop="50dp"&&
&&&&android:orientation="vertical"&&&
&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&android:layout_height="2dp"&&
&&&&&&&&android:background="#ffbd2021"&&&
&&&&&&&&android:id="@+id/container"&&
&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&android:layout_height="100dp"&&
&&&&&&&&android:clipChildren="false"&&
&&&&&&&&android:gravity="center_horizontal"&&
&&&&&&&&android:layerType="software"&&
&&&&&&&&android:orientation="horizontal"&&&
&&&&&&&&&&
&&&&&&&&&&&&android:id="@+id/viewpager"&&
&&&&&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&&&&&android:layout_height="match_parent"&&
&&&&&&&&&&&&android:layout_marginLeft="110dp"&&
&&&&&&&&&&&&android:layout_marginRight="110dp"&&
&&&&&&&&&&&&android:clipChildren="false"&&&
&&&&&&&&&&
&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&android:layout_height="2dp"&&
&&&&&&&&android:background="#ffbd2021"&&&
&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&android:layout_height="wrap_content"&&
&&&&&&&&android:background="@drawable/line"&&&
&&&&&&&&android:id="@+id/title"&&
&&&&&&&&android:layout_width="match_parent"&&
&&&&&&&&android:layout_height="wrap_content"&&
&&&&&&&&android:layout_gravity="center"&&
&&&&&&&&android:gravity="center_horizontal"&&
&&&&&&&&android:scaleType="fitXY"&&
&&&&&&&&android:src="@drawable/ic_launcher"&&
&&&&&&&&android:text="baidu"&&
&&&&&&&&android:textSize="18sp"&&&
阅读(...) 评论()}

我要回帖

更多关于 红米4a怎么弄虚拟按键 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信