码迷,mamicode.com
首页 > 其他好文 > 详细

Momo自定义DialogFragment

时间:2014-07-19 00:08:39      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   os   

在Fragnment弹窗提示

XML

bubuko.com,布布扣
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:background="@drawable/bg_common_toast">
    <ImageView
        android:id="@+id/loadingdialog_fiv_icon"
        android:layout_width="30dip"
        android:layout_height="30dip"
        android:src="@drawable/logo2" />
    <TextView
        android:id="@+id/loadingdialog_htv_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:gravity="left|center"
        android:textColor="#004B7C"
        android:textSize="14sp" />
</LinearLayout>
View Code

类库:

bubuko.com,布布扣
public class FlippingLoadingDialogF:DialogFragment
    {
        TextView textView1;
        private string textViewText = "";
        private Android.Views.Animations.Animation mAnimation;
        public override Android.Views.View OnCreateView(Android.Views.LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Android 3.x+ still wants to show title: disable
            Dialog.Window.RequestFeature(WindowFeatures.NoTitle);
            // Create our view
            var view = inflater.Inflate(Resource.Layout.common_flipping_loading_diloag, container, true);
            // Handle dismiss button click
            textView1 = view.FindViewById<TextView>(Resource.Id.loadingdialog_htv_text);
            textView1.Text = textViewText;
            ImageView mFivIcon=view.FindViewById<ImageView>(Resource.Id.loadingdialog_fiv_icon);
        

            return view;
        }
        public void SetText(string str)
        {
            textViewText = str;
        }

        public override void OnResume()
        {
            // Auto size the dialog based on it‘s contents
            Dialog.Window.SetLayout(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

            // Make sure there is no background behind our view
            Dialog.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent));

            // Disable standard dialog styling/frame/theme: our custom view should create full UI
            SetStyle(DialogFragmentStyle.NoFrame, Android.Resource.Style.Theme);

            base.OnResume();
        }



        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);


        }
    }
View Code

引用:

FlippingLoadingDialogF dialog = new FlippingLoadingDialogF ();
dialog.SetText ("数据加载中,请稍后...");
dialog.Show (this.Activity.FragmentManager, "dialog");

Momo自定义DialogFragment,布布扣,bubuko.com

Momo自定义DialogFragment

标签:android   style   blog   http   color   os   

原文地址:http://www.cnblogs.com/phinex/p/3853531.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!