change color of imageview

Put your problem here if it does not fit any of the other categories.

change color of imageview

Postby rmeph » Thu Feb 28, 2008 2:51 pm

i use imageview in xml

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <ImageView android:id="@+id/img1"
  2.  
  3.      android:layout_width="fill_parent"
  4.  
  5.      android:layout_height="fill_parent"
  6.  
  7.        android:background="@drawable/shape_1"
  8.  
  9.      />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4

and in shape_1

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <shape xmlns:android="http://schemas.android.com/apk/res/android" type="rectangle">
  2.  
  3.     <gradient android:startColor="#0000ff" android:endColor="#f0f0"
  4.  
  5.     android:angle="270"/>
  6.  
  7.     <padding android:left="40dp" android:top="40dp"
  8.  
  9.     android:right="40dp" android:bottom="40dp"  />
  10.  
  11.     <corners android:radius="5dp" />
  12.  
  13.    </shape>
Parsed in 0.002 seconds, using GeSHi 1.0.8.4


i want set color of imageview to java code

i use setColorFilter() but it's not work....how to set color of imageview??
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Postby plusminus » Thu Feb 28, 2008 4:10 pm

Hello rmeph,

what about:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. myImageView.setBackground(...); // takes resID, Drawable or Color
Parsed in 0.029 seconds, using GeSHi 1.0.8.4


Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby rmeph » Sat Mar 01, 2008 3:50 pm

problem

when i used
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. im.setBackgroundColor(0xFFFFFFFF);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


it no change color...
i cannot use res/drawable/color.xml file...i want direct pass color value...is possible to set direct value how???
rmeph
Senior Developer
Senior Developer
 
Posts: 121
Joined: Mon Dec 10, 2007 1:54 pm
Location: India

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests