Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I wrote a class that can be used in Android 2.1/2 that will do the right thing in 2.3 using reflection with ListViews:</p> <pre><code>import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.widget.ListView; public class TransparentListView extends ListView { private void makeTransparent() { if (Build.VERSION.SDK_INT &gt;= 9) { try { Method overscrollFooterMethod = TransparentListView.class.getMethod("setOverscrollFooter", new Class[] {Drawable.class}); Method overscrollHeaderMethod = TransparentListView.class.getMethod("setOverscrollHeader", new Class[] {Drawable.class}); try { overscrollFooterMethod.invoke(this, new Object[] {null}); overscrollHeaderMethod.invoke(this, new Object[] {null}); } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } } } public TransparentListView(Context context) { super(context); this.makeTransparent(); } public TransparentListView(Context context, AttributeSet attrs) { super(context, attrs); this.makeTransparent(); } public TransparentListView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); this.makeTransparent(); } } </code></pre> <p>Use it in XML as follows:</p> <pre><code>&lt;com.myapp.TransparentListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="fill_parent" android:transcriptMode="alwaysScroll" android:layout_weight="1" android:dividerHeight="0dip" android:divider="#00000000" android:cacheColorHint="#00000000" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload