예제 #1
0
 /// <summary>
 /// Apply elevation and translationZ on the views for API 21+ devices.
 /// </summary>
 /// <param name="elevation">Size of the elevation.</param>
 /// <param name="translationZ">Size of the translationZ.</param>
 /// <param name="views">Views on which the elevation is to be applied.</param>
 public static void SetElevation(float elevation, float translationZ, params View[] views)
 {
     foreach (View view in views)
     {
         if (Build.VERSION.SdkInt >= BuildVersionCodes.Lollipop)
         {
             ViewCompat.SetElevation(view, elevation);
             ViewCompat.SetTranslationZ(view, translationZ);
         }
     }
 }
예제 #2
0
        private void InitComponent(View view)
        {
            try
            {
                MRecycler        = (RecyclerView)view.FindViewById(Resource.Id.recyler);
                EmptyStateLayout = view.FindViewById <ViewStub>(Resource.Id.viewStub);

                LoadingLinear            = (LinearLayout)view.FindViewById(Resource.Id.Loading_LinearLayout);
                LoadingLinear.Visibility = ViewStates.Visible;

                ViewPagerView = view.FindViewById <ViewPager>(Resource.Id.viewpager2);

                MainAppBarLayout = view.FindViewById <AppBarLayout>(Resource.Id.mainAppBarLayout);
                MainAppBarLayout.SetExpanded(false);

                CollapsingToolbarLayout = (CollapsingToolbarLayout)view.FindViewById(Resource.Id.collapsingToolbar);
                ToolbarLogo             = view.FindViewById <ImageView>(Resource.Id.ToolbarLogo);
                ToolbarLogoLinearLayout = view.FindViewById <LinearLayout>(Resource.Id.ToolbarLogoLinearLayout);

                if (AppSettings.ShowAppLogoInToolbar)
                {
                    CollapsingToolbarLayout.SetTitle(" ");
                    MainAppBarLayout.AddOnOffsetChangedListener(this);

                    ToolbarLogoLinearLayout.BringToFront();
                    ViewCompat.SetTranslationZ(ToolbarLogoLinearLayout, 100);
                    ((View)ToolbarLogoLinearLayout.Parent).RequestLayout();
                }
                else
                {
                    CollapsingToolbarLayout.Title = AppSettings.ApplicationName;
                }

                SwipeRefreshLayout = (SpringView)view.FindViewById(Resource.Id.material_style_ptr_frame);
                SwipeRefreshLayout.SetType(SpringView.Type.Overlap);
                SwipeRefreshLayout.Header = new Helpers.PullSwipeStyles.DefaultHeader(Activity);
                SwipeRefreshLayout.Footer = new Helpers.PullSwipeStyles.DefaultFooter(Activity);
                SwipeRefreshLayout.Enable = true;
                SwipeRefreshLayout.SetListener(this);

                MainAlert            = (RelativeLayout)view.FindViewById(Resource.Id.mainAlert);
                MainAlert.Visibility = !UserDetails.IsLogin ? ViewStates.Visible : ViewStates.Gone;
                MainAlert.Click     += MainAlertOnClick;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
예제 #3
0
 public static void SetTranslationZ(this AView view, Context context, double translationZ)
 {
     ViewCompat.SetTranslationZ(view, context.ToPixels(translationZ));
 }