Draw A Triangle With Background Color?

Mar 7, 2014

I did this, how can i color the background of it though?>

[HIGH]Bitmap canvasBitmap = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888); BitmapShader shader = new BitmapShader(canvasBitmap, TileMode.CLAMP, TileMode.CLAMP); Canvas canvas = new Canvas(canvasBitmap); Paint paint = new Paint(); //paint.setStyle(Paint.Style.FILL); paint.setStrokeWidth(3); paint.setColor(Color.parseColor("#52c1b1")); canvas.drawLine(0, 0 , width, 0 , paint); canvas.drawLine(0, 0 , width/2, width/2 , paint); canvas.drawLine(width, 0 , width/2, width/2 , paint); return canvasBitmap;[/HIGH]

Draw a triangle with background color?


Android :: Android - Color State List Resources - Specify A Background Color

Oct 17, 2010

To give the user of my app an indication which field currently has the focus I am trying to change the background color of some of my fields depending on the current state, however, I am having troubles understanding Androids Color State List Resources:

There is this example at the bottom of http://developer.android.com/guide/topics/resources/color-list-resource.html. If I try exactly the same, i.e. if I want to adapt the textColor , things do work. However, if I try an only slightly different thing, namely to adapt the background color, things do not work and I don't understand why? Why is this so inconsistent?

To make it simpler to understand what I am trying to do, I append my misc. .xml files:

The AndroidManifest.xml file:

CODE:.........

If I run this as shown here, it works, i.e. I get a button whose text color changes depending on whether the button is focuses, pressed, etc.

If I uncomment the lower button, where I just flipped the attribute values for textColor and background I get an exception, stating

... <item> tag requires a 'drawable' attribute or child tag defining a drawable

What the heck am I missing here? Why is that color state list acceptable as a text color but not as a background color? How does one specify a view's background color depending on the view's state?

View 1 Replies View Related

Android :: Draw Scrollable Background For Droid Game?

Sep 12, 2009

I want to draw an image that on some levels may be larger than the screen as the background for a Android game. I want the user to be able to scroll the image using their finger on the touch screen.

Here is how I am drawing the background code...

View 1 Replies View Related

Android :: Draw Background Image With Moving Foreground Graphics?

Aug 28, 2010

I would like to know what the best way would be to draw a background image (this would be pretty much static) and a foreground object which would move depending on user input in Android?

Sort of like a side-scroller game (when the foregroudn object needs to animate and change a lot more than the background).

View 1 Replies View Related

Android : Draw A Button - Set A Stroke Color - Align" A Gradient To The Bottom Without Knowing The Height

Jan 27, 2010

I am creating a button programmatically. It is rounded and has a gradient background, and works fine and looks nice, but I couldn't do two things I wanted:

Set a 1 pixel stroke with a given color. I tried getPaint().setStroke(), but couldn't figure how to set the stroke color. How should I do it?
Align the gradient to the bottom of the button, no matter what height it has. Is this possible?

For reference, this is the code I'm using:

CODE:...................

View 1 Replies View Related

Android :: Set Button Background Color

Feb 27, 2010

How can I set button background color at run time?

View 6 Replies View Related

Android :: How To Set Button Background Color?

Oct 4, 2009

I have a question about setting the background color for buttons the entire button turns into a red rectangle. Is there actually a workaround to achieve this?Also what can I do to revert back to the default color of the button (the typical plain greysh background).

View 6 Replies View Related

Android :: How To Set Background Color Of View?

Jan 31, 2010

I'm trying to set the background color of a View (in this case a Button).It causes the Button to disappear from the screen.What am I doing wrong, and what is the correct way to change the background color on any View?

View 1 Replies View Related

Android :: Set Title Background Color

Feb 12, 2010

In my android application I want the standard/basic titlebar to change color.To change the tekst color you have setTitleColor(int color), is there a way to change the background of the bar?

View 4 Replies View Related

Android :: Background Color In A ImageButton

Jun 25, 2010

I put a background color in a ImageButton? How?

View 1 Replies View Related

How To Change Background Color In AlertDialog

Apr 30, 2013

how to change background color in AlertDialog?

It's multiple choice in AlertDialog .

View 2 Replies View Related

Using Eclipse - How To Change Background Color

Jul 2, 2013

how do i change the layout background color?

View 4 Replies View Related

Android :: View Background Color Animation

Nov 16, 2009

I was wondering if someone has a good answer to this.I am looking for a better way to animate a background color transition from on color to the next.Currently, I have two views, vCurrentColor which lays on top of the vNextColor, in a FrameLayout. I then animate the alpha of the currentColorView to zero. At the end of the animation I swap the positions of the views and repeat the process.

View 3 Replies View Related

Android :: Background Color Of Preference Screen

Feb 8, 2010

How to set the background color of a preference screen?

View 2 Replies View Related

Android :: Changing Background Color Of An Activity

Jan 31, 2010

When i launch Activity A, the screen goes black, then dark-gray. Then A launches B, and the screen goes black and dark-gray again. Is there a way to set the default background color to black? Activity A has no screen, its just a stub that calls B.

View 4 Replies View Related

Android :: How To Change AlertDialog's Background Color?

Jun 1, 2009

In Android, the AlertDialog's background color is light gray (#646464?), while I want to customize it to other color? I searched the groups and googled it online, and all about this is using style/theme to change that. I tried some solutions, but not succeeded.Anybody can give me a little more detailed solution?

View 2 Replies View Related

Android :: Is It Possible To Change Background Color Of Preference?

Feb 16, 2010

Does anybody know how to change the background color of Preference But this doesn't work.I searched these by using google, but couldn't find any right answer.Also, I couldn't find any way to change other layouts. (e.g. text color, size and style of preference title or summary)Is there no way to customize the layout of Preferences?It'll be great if somebody can help me out.

View 5 Replies View Related

Android :: How To Change Menu Background Color?

Dec 16, 2009

Is it possible to change the background color, style of the Menu items?

View 4 Replies View Related

HTC Desire :: How To Change Background Into Solid Color

May 16, 2010

Is it possible to change Wallpaper Background Image into SOLID COLOR only? I want change into totally black.

View 11 Replies View Related

Android :: Changing Background Color Of Tab Widget?

Jul 30, 2010

I am using TAB in my android application. I want to change the Background of each Tab at the load time only. The default color is grey.

View 1 Replies View Related

Android :: Need To Change Background Color Of Preference

Aug 23, 2010

I have a PreferenceCategory, xml file and I have defined all preferences in it, I call this from class that extends Preference Activity. I am unable to set the background of my settings screen , this screen is displayed with help of xml file shown below. Please see that I have already defined the android:background="#041A37", still the screen remains default color :black. Although I have set android:background="#041A37" in every file, the background doesn't turn into navy blue, or any other color for that matter. It remains default color, black. How to change the background color. Please let me know any pointers / hints , if you had faced same issue let me know what changes you made to set the background color. Code...

View 3 Replies View Related

HTC Desire :: How To Change Stock SMS Background Color?

Oct 3, 2010

I do a lot of texting and have noticed that my battery gets hammered when using the sms app and realized that it is black text on white background, which is clearly eating away at my battery. Is there any way of changing the background and text colour?

View 4 Replies View Related

Android :: Resetting The Background Color Of View

Sep 8, 2010

I'm trying to restore the background Color of a View. I have several selectable Views. When the user clicks one of those Views, the following code is executed and the View becomes Yellow:

View newSelection, previousSelection;

...

if(previousSelection != null) {
previousSelection.setBackgroundColor(Color.BLACK); // problem here
}
newSelection.setBackgroundColor(Color.YELLOW);

However, I want to reset the color of the previously selected View. However, I do not know which color it was (I'm setting it to Color.BLACK in the above code). I was not able to find a getBackgroundColor or similar method in the View class. If I had it, I could save the previous color and just put it back when the new View is selected.

View 2 Replies View Related

Android :: Get Background Color Of Activity In Java?

Sep 7, 2010

How can I get background color and text color (default for child views) of an Activity in Java?

View 1 Replies View Related

Android :: Selector On Background Color Of TextView

Aug 28, 2010

I'm attempting to change the background color of an Android TextView widget when the user touches it. I've created a selector for that purpose, which is stored in res/color/selector.xml and roughly looks like that:

CODE:................

The clickable attribute of the TextView is "true", in case that's of interest.

When I assign this selector to a TextView as android:background="@color/selector",

I'm getting the following exception at runtime: ERROR/AndroidRuntime(13130): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #6: <item> tag requires a 'drawable' attribute or child tag defining a drawable

When I change the attribute to drawable, it works, but the result is looking completely wrong because the IDs appear to be interpreted as image references instead of color references (as the "drawable" suggests).

What confuses me is that I can set a color reference, e.g. "@color/black", as the background attribute directly. This is working as expected. Using selectors doesn't work.

I can also use the selector as the textColor without problems.

What's the correct way to apply a background-color-selector to a TextView in Android?

View 2 Replies View Related

Android :: How To Set Tablelayout Row Background Color Programmatically

Oct 30, 2010

How to set tablelayout row background color programatically.

View 1 Replies View Related

Android : How To Set Background Color On Open GL ES Droid?

Sep 27, 2010

I am currently playing about with lesson 08 here http://insanitydesign.com/wp/projects/nehe-android-ports/ I would like to change the background colour from black to white. In order to do this at the start of onDrawFrame() I have called gl.glClearColor(1.0f, 0.0f, 0.0f, 0.0f); This does indeed set a white background screen, but also results in nothing else showing up on the screen! Clearly this is therefore an incorrect method, but why, and how do I fix it?

View 1 Replies View Related

Android : Settings.xml Won't Let Me Change Background Color

Jul 22, 2010

I've done this before...not sure what i'm doing wrong now I know it's the simplest thing in the world but i just want to make the text of my settings page black and the background white. Any ideas of what i'm doing wrong? my code....

View 1 Replies View Related

Change Background Color / Image Using PreferenceActivity?

Sep 9, 2012

is there a way to change the main activity background using preferences?I search everywhere and tried everything i could imagine but nothing works.

I want to enter in my preferenceActivity, choose "change background", open the phone's gallery, select a image/photo and set it as the "wallpaper" of my application.

View 1 Replies View Related

General :: How To Change Signal Background Color

Dec 11, 2012

I wanna ask about my green signal and green text carrier provider. Signal green not because my png green, my png has white color. I've tried to change png color but it still green.. How to change it..

Here is my pic ,framework-res and SystemUI on attach

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved