wheelviewandroid
① android wheelview 怎麼自定義樣式
*
* @param index the item index
* @return the wheel item text or null
*/
public String getItem(int index);
/**
* Gets maximum item length. It is used to determine the wheel width.
* If -1 is returned there will be used the default wheel width.
*
* @return the maximum item length or -1
*/
public int getMaximumLength();
}
② 誰有橫向的wheelview-Android開發問答
這是安卓自帶的日期選擇控制項如果你想自己實現的話,有個開源的框架,叫wheelView項目地址/wangjiegulu/WheelView實現的效果就是這樣的
③ android 怎樣用HorizontalScrollView左右彈性的菜單
{
SlidingMenumSlidingMenu;
@Override
protectedvoidonCreate(Bundlearg0){
super.onCreate(arg0);
setContentView(R.layout.main);
DisplayMetricsdm=newDisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
mSlidingMenu=(SlidingMenu)findViewById(R.id.slidingMenu);
mSlidingMenu.setAlignScreenWidth((dm.widthPixels/5)*2);
ViewleftView=getLayoutInflater().inflate(R.layout.left_menu,null);
ViewrightView=getLayoutInflater().inflate(R.layout.right_menu,null);
ViewcenterView=getLayoutInflater().inflate(R.layout.center,null);
mSlidingMenu.setLeftView(leftView);
mSlidingMenu.setRightView(rightView);
mSlidingMenu.setCenterView(centerView);
ButtonshowLeftMenu=(Button)centerView.findViewById(R.id.center_left_btn);
showLeftMenu.setOnClickListener(this);
ButtonshowRightMenu=(Button)centerView.findViewById(R.id.center_right_btn);
showRightMenu.setOnClickListener(this);
}
@Override
publicvoidonClick(Viewv){
//TODOAuto-generatedmethodstub
switch(v.getId()){
caseR.id.center_left_btn:
mSlidingMenu.showLeftView();
break;
caseR.id.center_right_btn:
mSlidingMenu.showRightView();
break;
default:
break;
}
}
}
④ 關於Android wheelview控制項的錯亂問題
setVisibleItems(int count)
把count設成單數就可以了
⑤ android wheelview為什麼只能展示一個
將布局文件轉換成視圖,再從中獲取那個TextView,再設置監聽,LayoutInflaterinflater=LayoutInflater.from(this);Viewview=inflater.inflate(R.layout.xxxxx,null);TextViewtv=(TextView)view.findViewById(R.id.tv_xx);tv.setOnXXXXXXX
⑥ android wheelview樣式怎麼改
android wheelview樣式的話,可以寫好xml,然後倒入:
Demo
Use the WheelView as a View, java and XML are both supported.
Java:
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main)
WheelView wheelView = (WheelView) findViewById(R.id.wheelview);
wheelView.setWheelAdapter(new ArrayWheelAdapter(this)); // 文本數據源
wheelView.setSkin(WheelView.Skin.Common); // common 皮膚
wheelView.setWheelData( ?); // 數據集合
}
}
XML:
<com.wx.wheelview.widget.WheelView
android:id="@+id/wheelview"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
⑦ 請教一個關於android wheel的問題,求高手
Activity代碼:::package com.winjing.meetingcontroller.ui;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Locale;
import kankan.wheel.R;
import kankan.wheel.widget.WheelView;
import kankan.wheel.widget.adapters.AbstractWheelTextAdapter;
import kankan.wheel.widget.adapters.NumericWheelAdapter;
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.FrameLayout;
import android.widget.LinearLayout;
import android.widget.TextView;
public class CreatNewMeetingActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_creat_new_meeting);
Calendar cal = Calendar.getInstance(Locale.CHINA);
final WheelView wheel_hour = (WheelView) findViewById(R.id.hour);
NumericWheelAdapter adapter_hour = new NumericWheelAdapter(this, 0, 23,
"%02d");
adapter_hour.setItemResource(R.layout.wheel_text_item);
adapter_hour.setItemTextResource(R.id.text);
wheel_hour.setViewAdapter(adapter_hour);
// 循環滾動
wheel_hour.setCyclic(true);
final WheelView wheel_minute = (WheelView) findViewById(R.id.minute);
NumericWheelAdapter adapter_minute = new NumericWheelAdapter(this, 0,
59, "%02d");
adapter_minute.setItemResource(R.layout.wheel_text_item);
adapter_minute.setItemTextResource(R.id.text);
wheel_minute.setViewAdapter(adapter_minute);
wheel_minute.setCyclic(true);
// ////////////////////////////
final WheelView wheel_meeting_hour = (WheelView) findViewById(R.id.meeting_hour);
NumericWheelAdapter adapter_meeting_hour = new NumericWheelAdapter(
this, 0, 23, "%02d");
adapter_meeting_hour.setItemResource(R.layout.wheel_text_item);
adapter_meeting_hour.setItemTextResource(R.id.text);
wheel_meeting_hour.setViewAdapter(adapter_meeting_hour);
wheel_meeting_hour.setCyclic(true);
final WheelView wheel_meeting_minute = (WheelView) findViewById(R.id.meeting_minute);
NumericWheelAdapter adapter_meeting_minute = new NumericWheelAdapter(
this, 0, 59, "%02d");
adapter_meeting_minute.setItemResource(R.layout.wheel_text_item);
adapter_meeting_minute.setItemTextResource(R.id.text);
wheel_meeting_minute.setViewAdapter(adapter_meeting_minute);
wheel_meeting_minute.setCyclic(true);
// ////////////////////////////////
Calendar calendar = Calendar.getInstance(Locale.CHINA);
wheel_hour.setCurrentItem(calendar.get(Calendar.HOUR));
wheel_minute.setCurrentItem(calendar.get(Calendar.MINUTE));
final WheelView wheel_day = (WheelView) findViewById(R.id.day);
wheel_day.setViewAdapter(new DayAdapter(this, calendar));
// wheel_day.setCurrentItem(calendar.get(Calendar.DAY_OF_YEAR), false);
wheel_day.setCyclic(true);
}
private class DayAdapter extends AbstractWheelTextAdapter {
// 向下的天數
private final int daysCount = 20;
private Calendar calendar;
/**
* Constructor
*/
protected DayAdapter(Context context, Calendar calendar) {
super(context, R.layout.time2_day, NO_RESOURCE);
this.calendar = calendar;
setItemTextResource(R.id.time2_monthday);
}
@Override
public View getItem(int index, View cachedView, ViewGroup parent) {
// int day = -daysCount / 2 + index;
int day = -daysCount / 2 + index;
int sum = day + index;
Log.v("getItem", "day = " + day + "; index = " + index
+ "; day + index = " + (day + index));
Calendar newCalendar = (Calendar) calendar.clone();
newCalendar.roll(Calendar.DAY_OF_YEAR, day);
View view = super.getItem(index, cachedView, parent);
if (day == 0) {
TextView weekday = (TextView) view
.findViewById(R.id.time2_weekday);
weekday.setText("");
TextView monthday = (TextView) view
.findViewById(R.id.time2_monthday);
monthday.setText("今天");
monthday.setTextColor(0xFF0000F0);
} else {
if (day > 0) {
TextView weekday = (TextView) view
.findViewById(R.id.time2_weekday);
DateFormat format_week = new SimpleDateFormat("EEE");
weekday.setText(format_week.format(newCalendar.getTime()));
TextView monthday = (TextView) view
.findViewById(R.id.time2_monthday);
DateFormat format_month = new SimpleDateFormat("MMM d");
monthday.setText(format_month.format(newCalendar.getTime()));
monthday.setTextColor(0xFF111111);
} else {
TextView weekday_move = (TextView) view
.findViewById(R.id.time2_weekday);
weekday_move.setText("##");
}
}
return view;
}
@Override
public int getItemsCount() {
return daysCount + 1;
}
@Override
protected CharSequence getItemText(int index) {
return "";
}
}
}
⑧ android 怎麼得到wheelview的值
TextView text=(TextView)findViewById(R.id.textview01); String s=text.getText().toString().trim(); Intent myIntentDial=new Intent("android.intent.action.CALL",Uri.parse("tel:"+s)); startActivity(myIntentDial);