<EditText
android:layout_width="match_parent"
android:layout_height="45sp"
android:layout_marginTop="10sp"
android:textColor="#000"
android:id="@+id/main_email_tv"
android:inputType="textCapWords"
android:hint="Email"
android:textSize="25sp"
android:drawableRight="@drawable/lock"
/>
我在右侧的edittext中添加锁定图像,但问题是无法在edittext中调整图像大小。
实际上我正在寻找这个选项,最后得到了。 机器人:drawableLeft =“@绘制/ PIC 通过此选项,可以在EditText的左侧显示图像。 对于寻找相同类型答案的其他人,必须确保图像的大小应该在25-35px左右,否则图像将无法在editetxt中正确显示。
答案 0 :(得分:2)
像这样设置你的图像
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="30dp"
>
<EditText
android:id="@+id/edt_dob"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_weight="1"
android:background="@null"
android:editable="false"
android:focusable="false"
android:hint="Date Of Birth"
android:paddingLeft="10dp"
android:textColor="#ffffff"
android:textColorHint="#ffffff" />
<ImageView
android:id="@+id/img_date"
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:src="@drawable/calendar" />
</LinearLayout>
答案 1 :(得分:1)
使用此功能而不是单独使用var gulp = require('gulp');
var fs = require('fs');
var path = require('path');
var merge = require('gulp-merge-json');
const files = [];
const parentFolders = [];
let streams = [];
const baseNames = [];
// note that the way 'gulp-merge-json' works is the last file having the same key as an earlier file 'wins' on the merge
// so whichever directory is listed last in the folders array will have PRECEDENCE
// 'gulp-merge-json' will also take an 'edit' function option
// [ in the comments you said you wanted the 'lang' folder structure preserved in './dist'
// but with 'lang_additional' precedence ]
// By the way, this works with more than two directories or it can work with
// folders of different levels such as:
// const folders = ['lang', 'lang_additional/module1/subModule2'];
// only merging those files with the same directory structure starting at the deepest
// levels only. So in the above example, only within subModule2 and below.
const folders = ['lang', 'lang_additional'];
gulp.task('mergeJSON', function () {
getFiles(folders);
makeStreams();
// streams[1] = lang\module1\file2.json, lang_additional\module1\file2.json
// spin up multiple "streams", not really a stream yet until gulp.src creates one
streams.forEach(function (stream) {
// get the fileName from one of the stream files, they all end with the same file
let fileName = path.basename(stream[stream.length - 1]);
// get the directories of one of the streams, again all files within a stream have the same directories
let dirName = path.dirname(stream[stream.length - 1]);
// strip off the first directory, leaving all subdirectories
dirName = dirName.substr(dirName.indexOf(path.sep));
return gulp.src(stream)
.pipe(merge({ fileName: fileName }))
// since the question wanted a dist/lang/subfolders hierarchy
.pipe(gulp.dest(path.join('./dist', 'lang', dirName)));
});
});
// getFiles is recursive, if a "file" retrieved by fs.readdirSync is a directory
function getFiles(folders) {
let possibleDirectory;
folders.forEach(function (folder, index) {
// read the file list from each directory
let tempFiles = fs.readdirSync('./' + folder);
tempFiles.forEach(function (fileOrDirectory) {
possibleDirectory = path.join(folder, fileOrDirectory);
if (fs.lstatSync(possibleDirectory).isDirectory()) {
getFiles([possibleDirectory]);
}
else {
// files[] will include all files found under the folders array
files.push(path.join(folder, fileOrDirectory));
if (baseNames.indexOf(fileOrDirectory) === -1) {
// if that file name element doesn't already exist in baseName array
// an array of just the basenames of true files
baseNames.push(fileOrDirectory);
}
}
});
});
}
function makeStreams() {
// for each file, find and save its parent directories without the folders[] "root" directories
files.forEach(function (file) {
let thisParentFolders = path.dirname(file).substr(file.indexOf(path.sep));
if (parentFolders.indexOf(thisParentFolders) === -1) {
// if that parentfolder doesn't already exist in baseName array
parentFolders.push(thisParentFolders);
}
});
// now loop through all unique directories looking for those files with each parentFolder with baseName attached
parentFolders.forEach(function (folder) {
let foldersFile = folder.substr(folder.indexOf(path.sep));
baseNames.forEach(function (baseName) {
streams.push(files.filter(function (file) {
return file.endsWith(path.join(foldersFile, baseName));
}));
});
});
// Here: remove any "streams" (array sub-elements) that have only one file in them, length == 1
// But for now this filter is necessary due to a undefined entry in .
streams = streams.filter( stream => stream.length >= 1);
streams.forEach( (stream, index) => console.log("streams[" + index + "] = " + stream));
}
import cv2
import os
def facecrop(image):
facedata = "haarcascade_frontalface_alt.xml"
cascade = cv2.CascadeClassifier(facedata)
img = cv2.imread(image)
minisize = (img.shape[1],img.shape[0])
miniframe = cv2.resize(img, minisize)
faces = cascade.detectMultiScale(miniframe)
for f in faces:
x, y, w, h = [ v for v in f ]
cv2.rectangle(img, (x,y), (x+w,y+h), (255,255,255))
sub_face = img[y:y+h, x:x+w]
fname, ext = os.path.splitext(image)
cv2.imwrite(fname+"_cropped_"+ext, sub_face)
return
facecrop("1.jpg")