android - Add bullet points between textview in horizontal listview -


i have horizontal listview of text. want add colored bullet points in between texts. used gallery display horizontal listview. final view should same in image. also, how divider in image between gallery , textview?

activity    public class mainactivity extends activity {  	  	 gallery myhorizontallistview;  	 myadapter myadapter;    	@override  	protected void oncreate(bundle savedinstancestate) {  		super.oncreate(savedinstancestate);  		setcontentview(r.layout.activity_main);  		myhorizontallistview = (gallery)findviewbyid(r.id.horizontallistview);  	       	      myadapter = new myadapter(this);  	      myhorizontallistview.setadapter(myadapter);  	       	      myhorizontallistview.setonitemclicklistener(new onitemclicklistener(){  	   	   @override  	   public void onitemclick(adapterview<?> parent, view view, int position,  	     long id) {  	    toast.maketext(mainactivity.this, parent.getitematposition(position).tostring() + " clicked", toast.length_long).show();  	       	   }});  	       	  }  	   	  public class myadapter extends baseadapter {  	      	   context context;  	      	   string[] itemsarray = {  	     "sun","mon", "tus", "wed", "thu", "fri", "sat"};  	      	   myadapter(context c){  	    context = c;  	   }  	   	  @override  	  public int getcount() {  	   // todo auto-generated method stub  	   return itemsarray.length;  	  }  	   	  @override  	  public object getitem(int position) {  	   // todo auto-generated method stub  	   return itemsarray[position];  	  }  	   	  @override  	  public long getitemid(int position) {  	   // todo auto-generated method stub  	   return position;  	  }  	   	  @override  	  public view getview(int position, view convertview, viewgroup parent) {  	   // todo auto-generated method stub  	      	   view rowview = layoutinflater  	     .from(parent.getcontext())  	     .inflate(r.layout.row, null);  	   textview listtextview = (textview)rowview.findviewbyid(r.id.itemtext);  	   listtextview.settext(itemsarray[position]);  	      	   return rowview;  	  }  	     	     	  }  	}

i'm trying achieve this

use drawableleft property adding bullets in textview

as xml

android:drawableleft="your_file" 

also in view first image has no bullet in code put check

if(position == 0) listtextview.setcompounddrawableswithintrinsicbounds(0, 0, 0, 0); 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -