zoukankan      html  css  js  c++  java
  • Android 图片闪烁(延迟切换)

     1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     2     xmlns:tools="http://schemas.android.com/tools"
     3     android:layout_width="match_parent"
     4     android:layout_height="match_parent"
     5     android:orientation="vertical" >
     6 
     7     <TextView
     8         android:layout_width="wrap_content"
     9         android:layout_height="wrap_content"
    10         android:text="@string/hello_world" />
    11 
    12     <ViewFlipper
    13         android:id="@+id/flipper"
    14         android:layout_width="match_parent"
    15         android:layout_height="wrap_content"
    16         android:layout_alignParentTop="true"
    17         android:layout_marginTop="10dp"
    18         android:flipInterval="200" >
    19 
    20         <TextView
    21             android:id="@+id/text_1"
    22             android:layout_width="match_parent"
    23             android:layout_height="wrap_content"
    24             android:text="text_1" />
    25 
    26         <TextView
    27             android:id="@+id/text_2"
    28             android:layout_width="match_parent"
    29             android:layout_height="wrap_content"
    30             android:text="text_12" />
    31 
    32         <TextView
    33             android:id="@+id/text_3"
    34             android:layout_width="match_parent"
    35             android:layout_height="wrap_content"
    36             android:text="text_13" />
    37 
    38         <TextView
    39             android:id="@+id/text_4"
    40             android:layout_width="match_parent"
    41             android:layout_height="wrap_content"
    42             android:text="text_14" />
    43     </ViewFlipper>
    44 
    45     <Button
    46         android:id="@+id/btn"
    47         android:layout_width="wrap_content"
    48         android:layout_height="wrap_content"
    49         android:text="stop" />
    50 
    51 </LinearLayout>
     1 package com.example.demoviewfliper;
     2 
     3 import android.app.Activity;
     4 import android.os.Bundle;
     5 import android.view.View;
     6 import android.widget.Button;
     7 import android.widget.ViewFlipper;
     8 
     9 public class MainActivity extends Activity {
    10     ViewFlipper mVf;
    11     Button btn;
    12 
    13     @Override
    14     protected void onCreate(Bundle savedInstanceState) {
    15         super.onCreate(savedInstanceState);
    16         setContentView(R.layout.activity_main);
    17 
    18         mVf = (ViewFlipper) findViewById(R.id.flipper);
    19         mVf.startFlipping();
    20 
    21         btn = (Button) findViewById(R.id.btn);
    22         btn.setOnClickListener(new View.OnClickListener() {
    23 
    24             @Override
    25             public void onClick(View v) {
    26                 if (mVf != null && mVf.isFlipping()) {
    27                     mVf.stopFlipping();
    28                     mVf.setDisplayedChild(mVf.getChildCount() - 1);
    29                 }
    30 
    31             }
    32         });
    33     }
    34 
    35 }
  • 相关阅读:
    负载均衡的基础技术种类
    scp基本使用方法
    给linux添加yum源。
    Linux 克隆虚拟机引起的“Device eth0 does not seem to be present, delaying initialization”
    FastDFS-单机版安装
    已安装nginx动态添加模块
    FastDFS
    七、CentOS 6.5 下 Nginx的反向代理和负载均衡的实现
    www.xxx.com 与 m.xxx.com 的Nginx服务器实现
    六、CentOS 6.5 下Nginx的配置
  • 原文地址:https://www.cnblogs.com/jinglecode/p/5511656.html
Copyright © 2011-2022 走看看