1

I am using this template on the main page of my application :

<ActionBar title="{{ 'activity_explorer' | L }}" row="0" android.icon="res://icon"
android.iconVisibilty="always">
    <ActionItem icon="res://icon_plus" text="{{'menuitem_new' | L}}" (tap)="showMenuItemNew()"></ActionItem>
</ActionBar>

<GridLayout rows="*" modal-dialog-host>

    <ListView row="0" [items]="_filesObservable | async">
        <template let-item="item">
            <GridLayout columns="1*, 7*" (tap)="processItem(item)">
                    <Image col="0" [src]="item.isDirectory()? 'res://folder' : 'res://file'"></Image>
                    <Label col="1" [text]="item.name()" textWrap="true"></Label>
            </GridLayout>
        </template>
    </ListView>

</GridLayout>

(I am also using an external css file for the related component)

I am using Angular2 and TypeScript version.

Is there a simple way to make the listview scrollbar always visible ?

Edit : is there also a portable solution, that can work on Android as well as on IOS ?

loloof64
  • 5,252
  • 12
  • 41
  • 78
  • 1
    Apple are recommending not yo use visible scrolls in iOS mobile apps - check the answers given here http://stackoverflow.com/questions/13697215/make-scrollbar-always-visible-on-uiscrollview – Nick Iliev Aug 03 '16 at 10:17
  • Ok. you're right. It just that sometimes it is not clear if there remains content at top or bottom. But if it is not advised, I can avoid this hassle. – loloof64 Aug 03 '16 at 10:23

1 Answers1

1

For android, get the listview from XML by id and do this:

var myListView = page.getViewById("myListView");    
myListView.android.setFastScrollAlwaysVisible(true);

For iOS, as what I have known, it's pretty impossible at this time to do the same. The best thing that can be done is to make the scrollbar blinking with a small timer interval.

Hope this helps

Dean Le
  • 2,094
  • 13
  • 17
  • Thanks. Is there also a way to adapt this code for the ios users to be happy ? – loloof64 Aug 03 '16 at 09:38
  • As what I have known, it's pretty impossible at this time to do the same on iOS. The best thing that can be done is to make the scrollbar blinking with a small timer interval. P/s: if the answer above helps your question, could you mark as answered – Dean Le Aug 03 '16 at 09:54
  • Could you give me a simple snippet in your answer, so I can try it out ? – loloof64 Aug 03 '16 at 09:55
  • I also tried your answer, but it does not work for me. – loloof64 Aug 03 '16 at 09:56
  • I have tried and it works for me. The code is not really complicated, I will update the answer – Dean Le Aug 03 '16 at 09:57
  • I have given an id to my listView, fetch it with ViewChild annotation, set your code in ngAfterInit hook, but still didn't work. I am doing this way because I write code in typescript. – loloof64 Aug 03 '16 at 09:58