ScrollView in Navigation Drawer

566 views
Skip to first unread message

Cagri Cuhadaroglu

unread,
Dec 23, 2013, 4:41:48 PM12/23/13
to kivy-...@googlegroups.com
i am try to use uix.scrollview in Navigation Drawer

https://github.com/kivy-garden/garden.navigationdrawer

it is running but scroll function does'nt work at sidebar,

   

    layout2 = BoxLayout(orientation='vertical')
    layout2.add_widget(Label(size_hint_y=None, height=dp(100),text='Toolbox'))
    LV_button = Button(size_hint_y=None, height=dp(100),text='1')
    LV_button.bind()##add action
    layout2.add_widget(LV_button)
    Al_button = Button(size_hint_y=None, height=dp(100),text='2')
    Al_button.bind()##add action
    layout2.add_widget(Al_button)
    Con_button = Button(size_hint_y=None, height=dp(100),text='3')
    Con_button.bind()##add action
    layout2.add_widget(Con_button)
    Iro_button = Button(size_hint_y=None, height=dp(100),text='4')
    Iro_button.bind()##add action
    layout2.add_widget(Iro_button)
    VD_button = Button(size_hint_y=None, height=dp(100),text='5')
    VD_button.bind()##add action
    layout2.add_widget(VD_button)
    PC_button = Button(size_hint_y=None, height=dp(100),text='6')
    PC_button.bind()##add action
    layout2.add_widget(PC_button)
    MV_button = Button(size_hint_y=None, height=dp(100),text='7')
    MV_button.bind()##add action
    layout2.add_widget(MV_button)



    scrollview1 = ScrollView(bar_width='20dp',do_scroll_x=False)###added
    scrollview1.add_widget(layout2)##addded


    side_panel=scrollview1   
    navigationdrawer.add_widget(side_panel)

Alexander Taylor

unread,
Dec 23, 2013, 6:31:14 PM12/23/13
to kivy-...@googlegroups.com
This looks like the standard ScrollView problem where you *must* manually set the size of its child, otherwise it will automatically be sized to exactly fit the ScrollView (and therefore not scroll because it all fits).

You nearly have it right, all the buttons have manual sizes, but the layout2 BoxLayout doesn't. I think it will probably work if you just set its size_hint_y to None and its height to something longer than the scrollview. You can then go further and set it to track the sum of heights of your buttons - or if you use a gridlayout, this automatically keeps track of that in its self.minimum_height property.

Cagri Cuhadaroglu

unread,
Dec 24, 2013, 5:25:25 AM12/24/13
to kivy-...@googlegroups.com
Thanks Alot : ) its solved .

"Size_hint_y" doesn't work,but entering size_hints like longer than 1 or exact number of pixel solves the problem.

The problem was about sizes

Thanks Much
Reply all
Reply to author
Forward
0 new messages