内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

wheel的使用

1、首先導入wheel庫或者將wheel文件拷到項目中

專注于為中小企業(yè)提供網站建設、網站制作服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)瓊結免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯網行業(yè)人才,有力地推動了1000+企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現規(guī)模擴充和轉變。

主類:

package com.example.view;

import android.app.Activity;

import android.content.Context;

import android.os.Bundle;

import android.util.Log;

import android.view.View;

import android.view.ViewGroup;

import android.widget.TextView;

import antistatic.spinnerwheel.AbstractWheel;

import antistatic.spinnerwheel.OnWheelClickedListener;

import antistatic.spinnerwheel.OnWheelScrollListener;

import antistatic.spinnerwheel.WheelView;

import antistatic.spinnerwheel.adapters.AbstractWheelTextAdapter;

public class MainActivity2 extends Activity {

private String TAG = "MainActivity2";

private WheelView wheelView1;

private MyAdapter viewAdapter;

private int mChoosedIndex;

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main_activity2);

wheelView1 = (WheelView) findViewById(R.id.wheelView1);

String[] arrMonths = new String[7];

for (int i = 1; i < arrMonths.length + 1; i++) {

arrMonths[i - 1] = i + "個月";

}

viewAdapter = new MyAdapter(this, arrMonths);//設置適配器

wheelView1.setViewAdapter(viewAdapter);

wheelView1.setDrawLine(false);//設置是否在前景圖上下畫線

wheelView1.setWheelForeground(R.drawable.wifi_notify);//設置前景圖片

wheelView1.setDrawShadows(false);//設置前景是否畫陰影

scrollToMiddle();//默認滑到中間一欄

wheelView1.addClickingListener(click);//設置點擊事件

wheelView1.addScrollingListener(scrollListener);//設置滑動事件

}

OnWheelClickedListener click = new OnWheelClickedListener() {

public void onItemClicked(WheelView wheel, int itemIndex) {

Log.e(TAG, ">>>>onItemClicked=WheelView>>"+itemIndex);

wheel.setCurrentItem(itemIndex, true);

//  viewAdapter .notifyDataChangedEvent();//刷新getItem

}

@Override

public void onItemClicked(AbstractWheel wheel, int itemIndex) {

// TODO Auto-generated method stub

Log.e(TAG, ">>>>onItemClicked=AbstractWheel>>"+itemIndex);

//  viewAdapter .notifyDataChangedEvent();//刷新getItem

}

};

OnWheelScrollListener scrollListener = new OnWheelScrollListener() {

@Override

public void onScrollingStarted(AbstractWheel wheel) {

// TODO Auto-generated method stub

Log.e(TAG, ">>>>onScrollingStarted=AbstractWheel>>");

}

@Override

public void onScrollingFinished(AbstractWheel wheel) {

// TODO Auto-generated method stub

Log.e(TAG, ">>>>onScrollingFinished=AbstractWheel>>");

//  viewAdapter .notifyDataChangedEvent();//刷新getItem

}

@Override

public void onScrollingStarted(WheelView wheel) {

// TODO Auto-generated method stub

Log.e(TAG, ">>>>onScrollingStarted=WheelView>>");

}

@Override

public void onScrollingFinished(WheelView wheel) {

// TODO Auto-generated method stub

                      //  viewAdapter .notifyDataChangedEvent();//刷新getItem

Log.e(TAG, ">>>>onScrollingFinished=WheelView>>");

}

};

/**

* @Title: scrollToLast

* @Description: 滑到滾輪中間

* @throws

*/

private void scrollToMiddle() {

wheelView1.stopScrolling();

int middleIndex = (wheelView1.getViewAdapter().getItemsCount() + 1) / 2;

mChoosedIndex = middleIndex;

Log.e("", ">>>>>" + middleIndex);

wheelView1.setCurrentItem(middleIndex);

}

private class MyAdapter extends AbstractWheelTextAdapter {

String[] arrMonths;

protected MyAdapter(Context context, String[] arrMonths) {

super(context, R.layout.wheel_item, NO_RESOURCE);

this.arrMonths = arrMonths;

}

@Override

public int getItemsCount() {

return arrMonths.length;

}

@Override

public View getItem(int index, View convertView, ViewGroup parent) {

View view = super.getItem(index, convertView, parent);

TextView tvItem = (TextView) view.findViewById(R.id.tv_item);

                        //在適配器中改變item的樣式

// if (index == mChoosedIndex) {

// tvItem.setTextColor(getResources().getColor(R.color.lightblue));

// } else {

// tvItem.setTextColor(getResources().getColor(

// R.color.gray_info_text));

// }

tvItem.setText(arrMonths[index]);

return view;

}

@Override

protected CharSequence getItemText(int index) {

return arrMonths[index];

}

public void notifyDataChangedEvent() {

super.notifyDataChangedEvent();

}

@Override

public void notifyDataInvalidatedEvent() {

super.notifyDataInvalidatedEvent();

}

}

}

 wheel_item文件:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

    <TextView

        android:id="@+id/tv_item"

        android:layout_width="80dp"

        android:layout_height="40dp"

        android:textColor="#ffffff"

        android:textSize="20sp"

        android:gravity="center"

        android:layout_gravity="center"

        android:background="#000000"

        android:text="tv" />

</LinearLayout>

布局文件:activity_main_activity2.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    tools:context=".MainActivity2" >

    <antistatic.spinnerwheel.WheelView

        android:id="@+id/wheelView1"

        android:layout_width="150dp"

        android:layout_height="200dp"

        android:layout_alignParentTop="true"

        android:layout_centerHorizontal="true"

        android:layout_marginTop="174dp"

        android:background="#ff00ff" />

</RelativeLayout>

附件:http://down.51cto.com/data/2367759

名稱欄目:wheel的使用
鏈接URL:http://www.rwnh.cn/article46/ghcseg.html

成都網站建設公司_創(chuàng)新互聯,為您提供企業(yè)網站制作、微信公眾號、網站改版、軟件開發(fā)、商城網站、營銷型網站建設

廣告

聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯

手機網站建設
乌海市| 台北县| 红安县| 女性| 乐业县| 耿马| 婺源县| 治县。| 江口县| 开江县| 咸丰县| 沧州市| 长阳| 台中县| 浮山县| 西青区| 新兴县| 浠水县| 长丰县| 夏河县| 岳西县| 饶河县| 黑河市| 固镇县| 会泽县| 凤凰县| 西吉县| 陆良县| 图木舒克市| 长汀县| 彰化市| 剑阁县| 汝城县| 健康| 兖州市| 蒲城县| 遂宁市| 通江县| 万源市| 望谟县| 油尖旺区|