我创建了一个按钮,我想为该按钮添加涟漪效果!
我创建了一个按钮bg XML文件:(bg_btn.xml)
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#FFFFFF" android:endColor="#00FF00" android:angle="270" />
<corners android:radius="3dp" />
<stroke android:width="5px" android:color="#000000" />
</shape>
Run Code Online (Sandbox Code Playgroud)
这是我的涟漪效应文件:(ripple_bg.xml)
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:color="#f816a463"
tools:targetApi="lollipop">
<item android:id="@android:id/mask">
<shape android:shape="rectangle">
<solid android:color="#f816a463" />
</shape>
</item>
</ripple>
Run Code Online (Sandbox Code Playgroud)
这是我想要添加涟漪效果的按钮:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button"
android:layout_centerHorizontal="true"
android:layout_marginTop="173dp"
android:textColor="#fff"
android:background="@drawable/ripple_bg"
android:clickable="true" />
Run Code Online (Sandbox Code Playgroud)
但添加涟漪效果后按钮背景是透明的,只有在点击时才会显示按钮,如下所示:
点击之前
点击

但我需要按钮背景颜色和涟漪效果,我在Stack Overflow的不同博客中发现了一些此代码,但它仍然无效!
我试图使用Python,OpenCv2和LBPH(从HERE下载)实现人脸识别
我的python版本是2.7.14
PIP版本是9.0.3
,OpenCV版本是3.4.0
我的代码是
import cv2
import numpy as np
import NameFind
# --- import the Haar cascades for face and eye ditection
face_cascade = cv2.CascadeClassifier('Haar/haarcascade_frontalcatface.xml')
eye_cascade = cv2.CascadeClassifier('Haar/haarcascade_eye.xml')
spec_cascade = cv2.CascadeClassifier('Haar/haarcascade_eye_tree_eyeglasses.xml')
help(cv2.face)
# FACE RECOGNISER OBJECT
LBPH = cv2.face.LBPHFaceRecognizer_create(2, 2, 7, 7, 20)
EIGEN = cv2.face.createEigenFaceRecognizer(10, 5000)
FISHER = cv2.face.createFisherFaceRecognizer(5, 500)
# Load the training data from the trainer to recognise the faces
LBPH.load("Recogniser/trainingDataLBPH.xml")
EIGEN.load("Recogniser/trainingDataEigan.xml")
FISHER.load("Recogniser/trainingDataFisher.xml")
# ------------------------------------ PHOTO INPUT -----------------------------------------------------
img = cv2.imread('Me4.jpg') # ------->>> …Run Code Online (Sandbox Code Playgroud) 如何一次在X和Y方向上旋转卡?
我有一个图像,我想在X和Y方向旋转它!
这是HTML,
<div class="card"></div>
Run Code Online (Sandbox Code Playgroud)
这是CSS,
.card {
background-image: url("https://i.stack.imgur.com/FW7wN.png");
height: 100px;
margin: 50px auto;
position: relative;
width: 100px;
-webkit-transition: .5s linear;
-webkit-transform-style: preserve-3d;
}
.card:hover {
-webkit-transform: rotateX(60deg);
}
Run Code Online (Sandbox Code Playgroud)
如果我将Y转换添加到悬停,它将进行唯一的第二次转换并忽略第一次转换
.card:hover {
-webkit-transform: rotateX(60deg);
-webkit-transform: rotateY(60deg);
}
Run Code Online (Sandbox Code Playgroud)
如何在X和Y对角线中翻译该卡?请帮我!
我在一个函数内有一个 ajax 调用,该函数在成功函数上返回一个 json 对象,我需要将返回的数据设置为一个变量,搜索答案但我找不到任何有用的答案。
方法 1:
即时调用函数并将返回值设置为这样的变量
var obj = ajaxCall();
Run Code Online (Sandbox Code Playgroud)
我的代码就像
function ajaxCall(){
var result;
$.ajax({
url: url_of_my_php_file,
dataType: 'json',
type: 'GET',
contentType: 'application/json',
success: function(data) {
// it returns json Object "data"
result = data;
}
});
return result;
}
Run Code Online (Sandbox Code Playgroud)
如果我在成功回调中记录数据,我的 json 与此类似
[{ collection: "Super Hero", img:"http://img_url.jpg",
heros: [{ id: "111", text: "Iron Man" },
{ id: "123", text: "Superman" },
{ id: "124", text: "Batman" }]
}]
Run Code Online (Sandbox Code Playgroud)
但它不返回值,而不是返回空字符串的值,因为该返回函数不等待 ajax 成功函数。
方法 2:
我尝试从成功调用函数并从该函数返回值,就像这样
function ajaxCall(){ …Run Code Online (Sandbox Code Playgroud) 我使用android-material-stepper库进行步骤实现,但在这里我可以使用一个片段,它显示了 3 个步骤。
我需要不同步骤的不同片段,如何使用?
我有不同的观点,比如片段 1 有日历,片段 2 有按钮,片段 3 有输入框。我想分别为每 3 个步骤使用所有 3 个片段。
我按照该 GitHub 页面中所示进行了实施,并且他们在 3 个步骤中仅使用了 1 个片段。有没有办法使用3个片段?如果不是,我如何区分同一片段中每个步骤的 3 个功能?
请帮忙!