多多色-多人伦交性欧美在线观看-多人伦精品一区二区三区视频-多色视频-免费黄色视屏网站-免费黄色在线

國內(nèi)最全I(xiàn)T社區(qū)平臺 聯(lián)系我們 | 收藏本站
阿里云優(yōu)惠2
您當(dāng)前位置:首頁 > php開源 > 綜合技術(shù) > 用最簡單的方法去實(shí)現(xiàn)android中的一些提示

用最簡單的方法去實(shí)現(xiàn)android中的一些提示

來源:程序員人生   發(fā)布時(shí)間:2014-12-14 08:18:16 閱讀次數(shù):2889次

看個(gè)效果

1,加載框代碼

2,對話框代碼

3,提示框代碼













+1列表動畫和側(cè)邊唆使條



===============1

package com.idonoo.frame.widget; import android.app.ProgressDialog; import android.content.Context; import android.os.Bundle; import android.text.TextUtils; import android.view.View; import android.widget.TextView; import com.idonoo.frame.R; /** * 對照1下,使用黑色背景的還是蠻多的. * @author intbird * */ public class ProgressDialogBar extends ProgressDialog { private String message; public ProgressDialogBar(Context context) { super(context, R.style.CustomDialog); } public ProgressDialogBar(Context context, String message) { super(context, R.style.CustomDialog); this.message = message; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.custom_progress_dialog); } @Override public void show() { show(message); } public void show(String message) { super.show(); if (!TextUtils.isEmpty(message)) { TextView text = (TextView) findViewById(R.id.tv_message); text.setVisibility(View.VISIBLE); text.setText(message); } } }
<?xml version="1.0" encoding="utf⑻"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linear_root" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/dialog_bg" android:gravity="center" android:minHeight="98dp" android:minWidth="98dp" android:orientation="horizontal" > <ProgressBar android:id="@+id/progress" android:layout_width="56dp" android:layout_height="56dp" android:layout_gravity="center" android:layout_margin="15dp" android:indeterminateDrawable="@drawable/progress_dialog" android:indeterminateDuration="1" android:max="100" android:progress="0" /> <TextView android:id="@+id/tv_message" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="30dp" android:text="" android:textColor="#FFFFFF" android:textSize="18sp" android:visibility="gone" /> </LinearLayout>
============2

package com.idonoo.shareCar.widget; import com.idonoo.shareCar.R; import android.app.Dialog; import android.app.AlertDialog.Builder; import android.content.Context; import android.os.Bundle; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.WindowManager.LayoutParams; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; /** * 對話框的樣式params需要注意; * @author intbird * */ public class MyAlertDialog extends Dialog { private View view; private TextView tvTitle,tvContent; private EditText edContent; private Button btnYes,btnCacel; public enum AlertStyle{ styleSingle,styleNoTitle,styleInput,styleTwoButton}; private Context context; public MyAlertDialog(Context context) { super(context,android.R.style.Theme_Translucent_NoTitleBar); this.context = context; initView(R.layout.layout_alert_dialog); } private void initView(int layoutId){ view= LayoutInflater.from(getContext()).inflate(layoutId, null); tvTitle=((TextView)view.findViewById(R.id.title)); tvContent=((TextView)view.findViewById(R.id.content)); edContent=(EditText)view.findViewById(R.id.ed_content); btnYes=(Button) view.findViewById(R.id.btn_yes); btnCacel=(Button) view.findViewById(R.id.btn_no); } public void initText(String title,String content) { tvTitle.setText(title); tvContent.setText(content); show(); } public MyAlertDialog(Context context,AlertStyle style){ this(context); switch (style) { case styleSingle: initView(R.layout.layout_alert_dialog_single); break; case styleNoTitle: initView(R.layout.layout_alert_dialog_notitle); break; case styleInput: initView(R.layout.layout_alert_dialog_input); break; case styleTwoButton: initView(R.layout.layout_alert_dialog); break; } } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(view); } public void setTextYes(String text){ btnYes.setText(text); } public void setTextNo(String text){ btnCacel.setText(text); } public EditText getEditText(){ return edContent; } public void setEditText(EditText edContent){ this.edContent=edContent; } @Override public void show() { super.show(); } public void show(String title,String content,View.OnClickListener yes){ initText(title, content); btnYes.setOnClickListener(yes); } public void show(String title,String content,View.OnClickListener yes,View.OnClickListener cacel){ initText(title, content); btnYes.setOnClickListener(yes); btnCacel.setOnClickListener(cacel); } public void show(String title,View.OnClickListener yes,View.OnClickListener cacel){ tvTitle.setText(title); btnYes.setOnClickListener(yes); btnCacel.setOnClickListener(cacel); show(); } @Override public void dismiss() { super.dismiss(); } @Override public void cancel() { super.cancel(); } public interface InputCallBack{ public void inputCallBack(EditText edit); } }

=======3

    protected void showToast(int res){ //all fragments should be initUI();     <span style="white-space:pre"> </span>String s=getResources().getString(res);     <span style="white-space:pre"> </span>showToast(s);     }     protected void showToast(CharSequence s){         if (!TextUtils.isEmpty(s.toString())){         <span style="white-space:pre"> </span>try{         <span style="white-space:pre"> </span>if(toast!=null)         <span style="white-space:pre"> </span>toast.cancel();         <span style="white-space:pre"> </span>toast=new Toast(getActivity());         <span style="white-space:pre"> </span>}catch(Exception ex){         <span style="white-space:pre"> </span>toast=null;         <span style="white-space:pre"> </span>}         <span style="white-space:pre"> </span>         <span style="white-space:pre"> </span>if(toast==null)         <span style="white-space:pre"> </span>return ;         <span style="white-space:pre"> </span>View view=getActivity().getLayoutInflater().inflate(R.layout.toasts, null);         <span style="white-space:pre"> </span>TextView text=(TextView) view.findViewById(R.id.tv_toast);         <span style="white-space:pre"> </span>text.setText(s.toString());         <span style="white-space:pre"> </span>         <span style="white-space:pre"> </span>toast.setView(view);         <span style="white-space:pre"> </span>toast.setDuration(Toast.LENGTH_SHORT);         <span style="white-space:pre"> </span>toast.show();         }     }




生活不易,碼農(nóng)辛苦
如果您覺得本網(wǎng)站對您的學(xué)習(xí)有所幫助,可以手機(jī)掃描二維碼進(jìn)行捐贈
程序員人生
------分隔線----------------------------
分享到:
------分隔線----------------------------
關(guān)閉
程序員人生
主站蜘蛛池模板: 国产精品日韩欧美一区二区三区 | 免费区一级欧美毛片 | 国精品一区二区三区 | 亚洲精品网站在线观看不卡无广告 | 国产精品免费_区二区三区观看 | 亚洲另类网| 伊人色影院 | 免费一级毛片清高播放 | a天堂v| 成人在线视频网站 | 性做久久久久久久免费看 | 欧美一级毛片生活片 | 男女视频在线观看免费 | 国产大片免费天天看 | 亚洲欧美日韩另类 | 中文字幕第30页 | 最近中文字幕在线视频 | 免费爱爱网站 | 国产成人爱片免费观看视频 | 欧美freesex10一13| 欧美一级别 | 有码视频在线观看 | 日韩理论片在线看免费观看 | 欧美成人性色大片在线观看 | 一级做a爰性视频 | 韩国在线观看免费观看影院 | 亚洲精品综合一区二区 | 在线视频一区二区三区 | free hd video 性欧美| 成人免费视频一区 | 亚洲人成图片欧美人成图片 | 国产精品视频流白浆免费视频 | 国产成人亚洲精品久久 | 久久精品国产线看观看亚洲 | 国产精品成人免费 | 国产色妇 | 成a人v欧美综合天堂 | 国产亚洲人成网站观看 | 欧美日韩国产一区二区三区不卡 | 久久3| 好吊日在线观看 |