日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

时间选择器

發布時間:2024/4/17 编程问答 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 时间选择器 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

xml

?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
??? android:id="@+id/time_line1"
??? android:layout_width="match_parent"
??? android:layout_height="wrap_content"
??? android:background="#A7c0dc"
??? android:gravity="center_horizontal"
??? android:orientation="vertical" >

??? <LinearLayout
??????? android:layout_width="match_parent"
??????? android:layout_height="wrap_content"
??????? android:padding="20px" >

??????? <NumberPicker
??????????? android:id="@+id/number"
??????????? android:layout_width="match_parent"
??????????? android:layout_height="match_parent"
??????????? android:gravity="center"
??????????? android:layout_weight="3" />

??????? <TimePicker
??????????? android:id="@+id/time"
??????????? android:layout_width="match_parent"
??????????? android:layout_height="wrap_content"
??????????? android:layout_weight="1" />
??? </LinearLayout>

??? <LinearLayout
??????? android:layout_width="match_parent"
??????? android:layout_height="wrap_content" >

??????? <Button
??????????? android:id="@+id/time_cancel"
??????????? android:layout_width="match_parent"
??????????? android:layout_height="wrap_content"
??????????? android:layout_margin="10dp"
??????????? android:layout_weight="1"
??????????? android:background="@drawable/dialog_btn_right_checked"
??????????? android:text="取消"
??????????? android:textColor="#fff" />

??????? <Button
??????????? android:id="@+id/time_ok"
??????????? android:layout_width="match_parent"
??????????? android:layout_height="wrap_content"
??????????? android:layout_margin="10dp"
??????????? android:layout_weight="1"
??????????? android:background="@drawable/dialog_btn_right_checked"
??????????? android:text="確認"
??????????? android:textColor="#fff" />
??? </LinearLayout>

</LinearLayout>

?

?

activity

package com.yunkun.inner_fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.yunkun.activity.AdressActivity;
import com.yunkun.activity.R;
import com.yunkun.activity.SongActivity;
import com.yunkun.popup.MyPopupWindow;

public class SendFrag extends Fragment implements OnClickListener {
?? ?private Button mOrder;
?? ?private RelativeLayout mStartadr;
?? ?private RelativeLayout mEndadr;
?? ?private RelativeLayout mGetgoodstime;
?? ?public static TextView helpsend_getgoodstime;
?? ?TextView mFreetext;

?? ?@Override
?? ?public View onCreateView(LayoutInflater inflater, ViewGroup container,
?? ??? ??? ?Bundle savedInstanceState) {
?? ??? ?// 找控件;
?? ??? ?View view = inflater.inflate(R.layout.send_fragmnet, null);
?? ??? ?findViewById(view);
?? ??? ?Listener();

?? ??? ?return view;
?? ?}

?? ?// 找控件;
?? ?private void findViewById(View view) {
?? ??? ?mStartadr = (RelativeLayout) view.findViewById(R.id.helpsend_rel1);

?? ??? ?mEndadr = (RelativeLayout) view.findViewById(R.id.helpsend_rel2);

?? ??? ?mGetgoodstime = (RelativeLayout) view.findViewById(R.id.helpsend_rel4);
?? ??? ?helpsend_getgoodstime = (TextView) view
?? ??? ??? ??? ?.findViewById(R.id.helpsend_getgoodstime);
?? ??? ?mFreetext = (TextView) view.findViewById(R.id.helpsend_freeperson);
?? ??? ?mOrder = (Button) view.findViewById(R.id.helpsend_order);
?? ?}

?? ?// 設置監聽
?? ?public void Listener() {
?? ??? ?mStartadr.setOnClickListener(this);
?? ??? ?mEndadr.setOnClickListener(this);
?? ??? ?mGetgoodstime.setOnClickListener(this);
?? ??? ?mFreetext.setOnClickListener(this);
?? ??? ?mOrder.setOnClickListener(this);
?? ?}

?? ?public void onClick(View v) {
?? ??? ?// TODO Auto-generated method stub
?? ??? ?switch (v.getId()) {
?? ??? ?// 點擊跳轉之地圖
?? ??? ?case R.id.helpsend_rel1:
?? ??? ??? ?Intent intent1 = new Intent(getActivity(), AdressActivity.class);
?? ??? ??? ?intent1.putExtra("property", "2");
?? ??? ??? ?startActivity(intent1);
?? ??? ??? ?break;
?? ??? ?case R.id.helpsend_rel2:
?? ??? ??? ?Intent intent2 = new Intent(getActivity(), AdressActivity.class);
?? ??? ??? ?intent2.putExtra("property", "3");
?? ??? ??? ?startActivity(intent2);

?? ??? ??? ?break;

?? ??? ?// 顯示取貨時間;
?? ??? ?case R.id.helpsend_rel4:
?? ??? ??? ?new MyPopupWindow(getActivity(), null, v);

?? ??? ??? ?break;
?? ??? ?case R.id.helpsend_freeperson:

?? ??? ??? ?break;
?? ??? ?case R.id.helpsend_order:
?? ??? ??? ?startActivity(new Intent(getActivity(),SongActivity.class));
?? ??? ??? ?break;
?? ??? ?}
?? ?}
?? ?// @Override
?? ?// public void onActivityResult(int requestCode, int resultCode, Intent
?? ?// data) {
?? ?// // TODO Auto-generated method stub
?? ?// super.onActivityResult(requestCode, resultCode, data);
?? ?// }
}

?

轉載于:https://www.cnblogs.com/weiyangge/p/5479578.html

總結

以上是生活随笔為你收集整理的时间选择器的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。