2017-02-05 19 views

答えて

0

RNDの数時間後、私は、XMLで動的に

private void navigationViewScrollThumbColor(NavigationView navigationView) { 

    if (navigationView != null) { 
     NavigationMenuView navigationMenuView = (NavigationMenuView) navigationView.getChildAt(0); 
     if (navigationMenuView != null) { 
      try { 
       Field mScrollCacheField = View.class.getDeclaredField("mScrollCache"); 
       mScrollCacheField.setAccessible(true); 
       Object mScrollCache = mScrollCacheField.get(navigationMenuView); 

       Field scrollBarField = mScrollCache.getClass().getDeclaredField("scrollBar"); 
       scrollBarField.setAccessible(true); 
       Object scrollBar = scrollBarField.get(mScrollCache); 

       Method method = scrollBar.getClass().getDeclaredMethod("setVerticalThumbDrawable", Drawable.class); 
       method.setAccessible(true); 
       method.invoke(scrollBar, getResources().getDrawable(R.drawable.color_of_your_Choice)); 
      } catch (Exception e) { 
       e.printStackTrace(); 
      } 

     } 
    } 
} 
を親指の色を変えていないのに役立ちます。この解決策を見つけた
関連する問題