Quantcast
Channel: xda-developers - Android Software and Hacking General [Developers Only]
Viewing all articles
Browse latest Browse all 3614

[Q] Fast Scroll in 4.4

$
0
0
Hello,

I've been working on an app that uses fast scroll in a list view. The fast scroll hasn't been an issue until my phone receive the 4.4 update. Fast scroll no longer appears to be working. I tested it in a 4.4 emulator with no luck. The only way I can get it to appear is rotate the screen once the activity has loaded which will make the fast scroll appear again. Any one run into this or have any ideas?

main_activity.xml
Code:

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <FrameLayout
      android:id="@+id/content_frame"
      android:layout_width="match_parent"
      android:layout_height="match_parent" />

  <ListView
      android:id="@+id/left_drawer"
      android:layout_width="240dp"
      android:layout_height="match_parent"
      android:layout_gravity="start"
      android:choiceMode="singleChoice"
      android:divider="@android:color/transparent"
      android:dividerHeight="0dp"
      android:background="#111"/>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="0dp"
    android:paddingLeft="2dp"
    android:paddingRight="2dp"
    android:paddingTop="0dp"
    tools:context=".MainActivity"> 
                   
    <ListView
        android:id="@+id/listView1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:clickable="true"
        android:dividerHeight="2dp"
        android:drawSelectorOnTop="false"
        android:scrollbars="vertical"
        android:fastScrollAlwaysVisible="true"
        android:fastScrollEnabled="true"
        android:longClickable="true" >
    </ListView>
   

    <ProgressBar
        android:id="@+id/progressBar"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:visibility="gone" />
</RelativeLayout>

</android.support.v4.widget.DrawerLayout>

MainActivity.java
Code:

    @Override
      protected void onDestroy() {
            super.onDestroy();
            handler.removeCallbacks(scrollLock);
      }
     
      private final Runnable scrollLock = new Runnable(){
              public void run(){
                  try {
                        listView = (ListView) findViewById(R.id.listView1);
                          listView.setFastScrollEnabled(true);
                          listView.setFastScrollAlwaysVisible(true);
                         
                      handler.postDelayed(this, 500);   
                  }
                  catch (Exception e) {
                      e.printStackTrace();
                  } 
              }

Thanks in advanced

Viewing all articles
Browse latest Browse all 3614

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>