【问题标题】:Android radial gradient background changes when keyboard is on-screen当键盘在屏幕上时,Android 径向渐变背景会发生变化
【发布时间】:2011-08-21 13:40:57
【问题描述】:

我目前正在使用以下代码将径向渐变应用到视图的背景:

<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>

当软键盘出现在屏幕上时,会出现问题,然后调整视图大小并重新绘制渐变以适应较小的视图。

有没有办法阻止这种情况发生,使径向渐变看起来不会改变,而不使用图像作为背景。我尝试使用android:centerXandroid:centerY,但它们不允许我在倾斜方面给出中心。

如果我的问题不清楚,我可以发布一张图片来解释问题。

提前感谢您的帮助。

【问题讨论】:

    标签: android layout background gradient radial


    【解决方案1】:

    您需要在AndroidManifest 中使用android:windowSoftInputMode="adjustPan"属性。

    <activity android:name=".MyActivity"
              android:label="@string/app_name"
              android:windowSoftInputMode="adjustPan">
    </activity>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多