Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9141605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:40:01+00:00 2026-06-17T09:40:01+00:00

EDIT: LOOK AT SOLUTION ABOVE i m freaking out. all i just want to

  • 0

EDIT: LOOK AT SOLUTION ABOVE

i m freaking out. all i just want to do, is setting a linear GradientDrawable, which changes the vertical center of the gradient… drawing the gradient works fine, but how can i change the center of it?!?

RelativeLayout bgScreen = (RelativeLayout) findViewById(R.id.player_screen);

GradientDrawable gd = new GradientDrawable(
     GradientDrawable.Orientation.TOP_BOTTOM,
     new int[] {startColor,endColor});

gd.setCornerRadius(0f);
gd.setAlpha(200);
bgScreen.setBackground(gd); 


public void redrawOrChangeBackgroundGradient(){
    //??? either change center of existing
    gd.setGradientCenter(float x, float y) //ONLY works in RADIAL_GRADIENT or SWEEP_GRADIENT.

    //??? or complete redraw Gradient with different center

}

here s a picture example of how i want to change the gradient via code

enter image description here

cannot be that hard, can it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:40:02+00:00Added an answer on June 17, 2026 at 9:40 am

    The lacking ability to set the center programmatically for linear GradientDrawables is a registered issue already.

    But there is a workaround described here. Basically, you should create a PaintDrawable from a LinearGradient and set it as your view’s background drawable. Following this solution, you can set the center in your LinearGradient constructor by mapping the colors to the positions array:

    float[] positions

    May be null. The relative positions [0..1] of each corresponding color
    in the colors array. If this is null, the colors are distributed
    evenly along the gradient line.

    (not tested, but it should do the trick for you)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: solved, look below for my solution. first of all, this is my very
I want to match a list of variables which look like directories, e.g.: Same/Same2/Foot/Ankle/Joint/Actuator/Sensor/Temperature/Value=4.123
EDIT 23-06-2012 10:24 (CET) : Found the answer Take a look at the bottom
EDIT To simplify this further. Let's take a look at this structure: Table1: idProduct
Take a look at my code example at js bin: http://jsbin.com/iritep/3/edit I'd like to
Edit: Two options shown below. If you're just using the functionality that an IDisposable
I have a C++ solution ( solution.sln ) where I want to include an
I am looking for dictionary source file format which is convenient to edit in
[Edit]: I figured out how to do this on my own. I posted my
http://jsfiddle.net/KKL5G/ Please take a look at the above html and css for the buttons.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.