コード例 #1
0
ファイル: PagesExample.cs プロジェクト: wonrst/nui-demo
        private void CreatePagesContainer()
        {
            LinearLayout linear = new LinearLayout();

            linear.LinearOrientation = LinearLayout.Orientation.Horizontal;

            pagesContainer = new View()
            {
                Layout              = linear,
                Name                = "PageContainer",
                WidthSpecification  = Window.Instance.WindowSize.Width * numberOfPages,
                HeightSpecification = LayoutParamPolicies.MatchParent,
                BackgroundColor     = new Color(0.4f, 0.7f, 1.0f, 1.0f),
                Padding             = new Extents(40, 40, 0, 0),
            };

            scrollable = new Tizen.NUI.Components.ScrollableBase()
            {
                Name = "ScrollableBase",
                // FlickAnimationSpeed = 0.8f,
                // FlickDistanceMultiplierRange = new Vector2(0.2f, 0.5f),
                ScrollingDirection = Tizen.NUI.Components.ScrollableBase.Direction.Horizontal,
                SnapToPage         = true,
            };
            scrollable.Add(pagesContainer);

            scrollable.WidthSpecification  = LayoutParamPolicies.MatchParent;
            scrollable.HeightSpecification = LayoutParamPolicies.MatchParent;

            root.Add(scrollable);
        }
コード例 #2
0
ファイル: PagesExample.cs プロジェクト: wonrst/nui-demo
        private View CreateScrollingList()
        {
            Tizen.NUI.Components.ScrollableBase scrollingView = new Tizen.NUI.Components.ScrollableBase()
            {
                Name = "LayoutScroller",
                // FlickAnimationSpeed = 0.8f,
                // FlickDistanceMultiplierRange = new Vector2(0.3f,0.6f),
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = (int)(Window.Instance.WindowSize.Height * 0.75),
            };

            View listItemsContainer = new View()
            {
                Layout = new LinearLayout {
                    LinearOrientation = LinearLayout.Orientation.Vertical
                },
                Name = "ListContainer",
                WidthSpecification  = LayoutParamPolicies.MatchParent,
                HeightSpecification = LayoutParamPolicies.WrapContent,
                Focusable           = true,
                Padding             = new Extents(40, 40, 0, 0),
            };

            foreach (string name in listItemNames)
            {
                TextLabel textLabel = new TextLabel()
                {
                    Text       = name,
                    Name       = "list-item-text-label-" + name,
                    Margin     = new Extents(90, 0, 0, 0),
                    TextColor  = Color.Black,
                    PointSize  = 68,
                    FontFamily = "SamsungOneUI 500C",
                };

                View listItem = new View
                {
                    WidthSpecification  = LayoutParamPolicies.MatchParent,
                    HeightSpecification = LayoutParamPolicies.WrapContent,
                    BackgroundColor     = Color.Blue,
                    Layout = new LinearLayout(),
                };

                listItem.Add(textLabel);

                listItemsContainer.Add(listItem);
            }

            scrollingView.Add(listItemsContainer);
            return(scrollingView);
        }
コード例 #3
0
 public static Rect GetScrollBound(this ScrollableBase view)
 {
     return(new Rect(-view.ContentContainer.Position.X, -view.ContentContainer.Position.Y, view.Size.Width, view.Size.Height));
 }
コード例 #4
0
 public static void SetScrollOrientation(this ScrollableBase view, ScrollOrientation orientation)
 {
     view.ScrollingDirection = orientation.ToNative();
 }