键盘显示时背景可绘制

时间:2019-04-16 15:21:37

标签: android

形状背景当键盘显示时,Drawable会随机出现,但我希望背景可以覆盖所有尺寸的按钮。我尝试为清单中的活动更改属性android:windowSoftInputMode,但没有结果https://imgur.com/a/gvJ2w0F

//1-Create a function "startTimer" with parameter "duration"
function startTimer(duration) {

//2-Declare a variable "timer" with some strange comma separated assignment (HELP HERE)
var timer = duration, minutes, seconds;

//3-Declare an unassigned variable "output"
var output;

//4-setInterval, which has the syntax *setInterval(function, milliseconds, param1, param2, ...)* indicated that the code below will be performed every interval of 1000 ms, or every one second.
setInterval(function () {

//5-Assign variable "minutes" the value of timer/60 and has radix (base) 10.
minutes = parseInt(timer / 60, 10);

//6-Assign variable "seconds" the value of timer mod 60 and has radix (base) 10.
seconds = parseInt(timer % 60, 10);

//7-Assign variable "minutes" to the value of "0" + minutes if minutes < 10, or minutes if not. This is accomplished with the ternary operator "?", which has syntax *condition ? exprT : exprF* 
minutes = minutes < 10 ? "0" + minutes : minutes;

//8-Assign variable "seconds" in the same way minutes are assigned, which adds a leading zero if the value is <10.
seconds = seconds < 10 ? "0" + seconds : seconds;

//9-Assign variable "output" to minutes concatenated with ":" concatenated with seconds
output = minutes + ":" + seconds;

//10-If the value of timer incremented downward by one (HELP ON WHAT THAT MEANS) is less than zero then assign variable "timer" to the value of variable "duration", which will be (HELP ON WHERE DURATION GETS ITS VALUE).
if (--timer < 0) {
timer = duration;
}

//11-Output the formatted timer to the console log
console.log(output);

//12-End the function performed in setInterval. Also set the interval in which the function is repeated to 1000 ms (the second argument in the setInterval function).
}, 1000);

//13-End of function startTimer
}

代码:

<Button
    android:id="@+id/onceBtn"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="52dp"
    android:layout_marginBottom="8dp"
    android:background="@drawable/blue_paralax_bg"
    android:text="@string/once_time_pay"
    android:textAllCaps="false"
    android:textColor="@color/md_white_1000"
    android:textStyle="bold" />

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
    <corners android:radius="8dp" />
        <gradient
                android:endColor="@color/md_light_blue_400"
                android:startColor="@color/md_light_blue_600" />
            <padding
                android:bottom="@dimen/background_padding"
                android:left="@dimen/background_padding"
                android:right="@dimen/background_padding"
                android:top="@dimen/background_padding"/>
</shape>

0 个答案:

没有答案