I don't know if it would work, but you could possibly try making the background image for each item as a transparent drawable and then setting the one background image you want on the listview...
Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Sun, Mar 25, 2012 at 9:02 AM, Ragav S <[email protected]> wrote: > > Hai, > > I need to show List View with background image. > > XML CODE: > ------------------- > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:layout_width="match_parent" > android:layout_height="match_parent" > android:orientation="vertical" > android:background="@drawable/bgimg"> > > > <ImageView > android:id="@+id/imageView1" > android:layout_width="wrap_content" > android:layout_height="70dp" > android:src="@drawable/test" /> > > <TextView > android:id="@+id/listView100" > android:text="" > android:paddingLeft="10dp" > android:paddingTop="15dp" > android:paddingBottom="15dp" > android:textSize="20sp" > android:layout_marginRight="1sp" > android:layout_marginLeft="1sp" > android:paddingRight="8dp" > android:layout_marginTop="5sp" > android:layout_width="match_parent" > android:layout_height="wrap_content" > android:textColor="@color/lightbrown"/> > </LinearLayout> > > Java Code: > --------------- > > > package p41.android.kiscol.act; > import android.app.ListActivity; > import android.os.Bundle; > import android.view.Window; > import android.view.animation.AlphaAnimation; > import android.view.animation.Animation; > import android.view.animation.AnimationSet; > import android.view.animation.LayoutAnimationController; > import android.view.animation.TranslateAnimation; > import android.widget.ArrayAdapter; > import android.widget.ImageView; > import android.widget.ListView; > > public class CompaniesActivity extends ListActivity { > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > this.requestWindowFeature(Window.FEATURE_NO_TITLE); > > String[] values = new String[] { > "TEST 1", > "TEST 2", > "TEST 3", > "TEST 4", > "TEST 5" > }; > > ArrayAdapter<String> adapter = new > ArrayAdapter<String>(this,R.layout.companies, R.id.listView100, > values); > setListAdapter(adapter); > > AnimationSet set = new AnimationSet(true); > Animation animation = new AlphaAnimation(0.0f, 1.0f); > animation.setDuration(1000); > set.addAnimation(animation); > getListView().setAnimationCacheEnabled(false); > getListView().setScrollingCacheEnabled( false); > > animation = new TranslateAnimation( > Animation.RELATIVE_TO_SELF, > 0.0f,Animation.RELATIVE_TO_SELF, 0.0f, > Animation.RELATIVE_TO_SELF, > -1.0f,Animation.RELATIVE_TO_SELF, 0.0f > ); > > set.addAnimation(animation); > LayoutAnimationController controller = new > LayoutAnimationController(set, 0.5f); > ListView listView; > listView = getListView(); > listView.setLayoutAnimation(controller); > } > > > } > > OUTPUT > ------------ > > But i got the result. > Each row having background image and image view. > But i need all rows with one background image and image view. > > Please give solution for that. > Thanks. > > > > > > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

