标签:android style blog http color os
在Fragnment弹窗提示
XML
<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>
类库:
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); } }
引用:
FlippingLoadingDialogF dialog = new FlippingLoadingDialogF (); dialog.SetText ("数据加载中,请稍后..."); dialog.Show (this.Activity.FragmentManager, "dialog");
Momo自定义DialogFragment,布布扣,bubuko.com
标签:android style blog http color os
原文地址:http://www.cnblogs.com/phinex/p/3853531.html