Inheritance: LinearLayoutManager
示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.About);

            // TODO cf. https://forums.xamarin.com/discussion/comment/61781/#Comment_61781
            // Use a ViewModel to prevent the use of this loop ?
            LinearLayout aboutMainLayout = FindViewById <LinearLayout>(Resource.Id.aboutMainLayout);

            // Loop over the layout looking for TextView
            for (int i = 0; i < aboutMainLayout.ChildCount; i++)
            {
                if (aboutMainLayout.GetChildAt(i) is TextView)
                {
                    TextView tv = (TextView)aboutMainLayout.GetChildAt(i);
                    // This is to make the "a href" clickable and it opens a web browser
                    tv.MovementMethod = LinkMovementMethod.Instance;
                }
            }

            List <StoreLink> links = new List <StoreLink>()
            {
                new StoreLink()
                {
                    Text             = Resources.GetString(Resource.String.aboutWinPhone),
                    ImageRessourceId = Resource.Drawable.ic_wpstore
                }
            };
            var list          = FindViewById <ListView>(Resource.Id.OtherDeviceAppList);
            var layoutManager = new CustomLinearLayoutManager(this);

            layoutManager.Orientation = (int)Orientation.Vertical;
            list.Adapter = (new AboutListAdapter2(this, links));
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.About);

            // TODO cf. https://forums.xamarin.com/discussion/comment/61781/#Comment_61781
            // Use a ViewModel to prevent the use of this loop ?
            LinearLayout aboutMainLayout = FindViewById<LinearLayout>(Resource.Id.aboutMainLayout);
            // Loop over the layout looking for TextView
            for (int i = 0; i < aboutMainLayout.ChildCount; i++)
            {
                if (aboutMainLayout.GetChildAt(i) is TextView)
                {
                    TextView tv = (TextView)aboutMainLayout.GetChildAt(i);
                    // This is to make the "a href" clickable and it opens a web browser
                    tv.MovementMethod = LinkMovementMethod.Instance;
                }
            }

            List<StoreLink> links = new List<StoreLink>()
            {
                  new StoreLink() {Text =Resources.GetString(Resource.String.aboutWinPhone),
                 ImageRessourceId =  Resource.Drawable.ic_wpstore}
            };
            var list = FindViewById<ListView>(Resource.Id.OtherDeviceAppList);
            var layoutManager = new CustomLinearLayoutManager(this);
            layoutManager.Orientation = (int)Orientation.Vertical;
            list.Adapter = (new AboutListAdapter2(this, links));
        }