0

I am trying to get the "fadingEdge" effect working on a list on a Xyboard 10.1 (Xoom 2) running Honeycomb 3.2.2. As a way to demonstrate the problem, I am using the basic android list-view tutorial, described here:

http://developer.android.com/resources/tutorials/views/hello-listview.html

The modified code looks like:

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

  String[] countries = getResources().getStringArray(R.array.countries_array);
  setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, countries));

  ListView lv = getListView();
  lv.setTextFilterEnabled(true);
  lv.setVerticalFadingEdgeEnabled( true );
  lv.setHorizontalFadingEdgeEnabled( true );
  lv.setFadingEdgeLength( 30 );

  lv.setOnItemClickListener(new OnItemClickListener() {
    public void onItemClick(AdapterView<?> parent, View view,
        int position, long id) {
      // When clicked, show a toast with the TextView text
      Toast.makeText(getApplicationContext(), ((TextView) view).getText(),
          Toast.LENGTH_SHORT).show();
    }
  });
}

Specifically, I added three lines in the middle that enable fading in both directions, and set an arbitrary fade length. I have also verified that valid and expected values are coming back from the get-fade-strength getters, so it is not a matter of the strength getters returning zero.

Note that in our real application, we must enable this functionality programatically, which is why I have not configured this behavior in XML.

Aside from the Xyboard, I have verified that this test class and fading-edge effect successfully works on every other device I have tried, including:

  • Galaxy Tab 8.9 (Honeycomb 3.1)
  • Galaxy Nexus (ICS 4.0)
  • emulator (Honeycomb 3.2)
TylerH
  • 20,799
  • 66
  • 75
  • 101
jmv
  • 1
  • 1
  • Have you verified that built-in applications show the fading edges correctly on the Xyboard? – sastraxi Mar 26 '12 at 20:03
  • Perhaps I just do not know where to look, but I don't see this effect anywhere. I have looked at several of the main, Google apps (like Youtube, Music, market, etc) and I do not see this fade. Is there any known app location where this fade effect is sure to be found, so that I can check? – jmv Mar 26 '12 at 20:32
  • It appears that the Kindle app (3.5.1) has a black fading edge at the bottom of the main book view. As an additional thought, it seems like fading edges have gone out of style in Android development--but I don't want to stop you from doing something based on creed. – sastraxi Mar 26 '12 at 20:55
  • I am running Kindle 3.5.1.1, and do not see any fading edges in the app. I checked both the book selection screens and the actual reading-book screens. I appreciate the comment about the fading going out of style, but it is currently serving a purpose in our application, and thus is useful to us until a suitable replacement is devised. – jmv Mar 26 '12 at 21:28
  • Just so that we're clear, when we're talking about "fading edges", we're talking about the way a `ListView` fades out to a certain colour at its edge when there's more content in that direction that isn't on-screen? – sastraxi Mar 26 '12 at 21:32
  • Yes, that is correct. I believe the feature will technically work with any view, but it is most commonly used with lists/scrollviews, etc - anything where a list of items goes offscreen and out of view. – jmv Mar 26 '12 at 22:13
  • Oh! Does your Xyboard have the Google Reader home screen widget? That has a fading edge on mine, too. – sastraxi Mar 27 '12 at 04:58
  • I just added the widget, and I do not see any fades on the edges. Are you using a Xyboard as well? – jmv Mar 27 '12 at 13:33
  • No, I have a Transformer Prime (4.0.3). I wish I knew what was going on--it's altogether possible they have customized their ROM to disable it, as there's nothing stopping a manufacturer from modifying the source code before shipping. – sastraxi Mar 27 '12 at 15:06

1 Answers1

4

Not sure if you have resolved this already but I have ran into similar issue and just decided to dive into the View.java class.

Before you would use the following to enable a fading edge:

android:fadingEdge="vertical"

Now you use:

android:requiresFadingEdge="vertical"
Jona
  • 13,325
  • 15
  • 86
  • 129