0

I'm currently using the following code to apply a radial gradient to the background of a view:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <gradient android:type="radial"
        android:gradientRadius="250"
        android:startColor="#479637"
        android:endColor="#3e6d34"
        />
</shape>

The problem arises when the soft keyboard is on-screen, the view is then resized and the gradient is redrawn to fit the smaller view.

Is there a way to stop this happening, so that the radial gradient does not appear to change, without using an image for the background. I tried using android:centerX and android:centerY but they don't allow me to give the center in terms of dips.

I can post an image explaining the problem if my question isn't clear.

Thanks for your help in advance.

woodstock365
  • 1,780
  • 4
  • 19
  • 35

1 Answers1

1

You will want to use the android:windowSoftInputMode="adjustPan"attribute in the AndroidManifest.

<activity android:name=".MyActivity"
          android:label="@string/app_name"
          android:windowSoftInputMode="adjustPan">
</activity>
Phil
  • 35,852
  • 23
  • 123
  • 164