我一直在 Snackbar 上工作,并在我的项目中取得了成功。但是,我想将这个小东西添加到 Snackbar 中,那就是margins. 我在这个链接中看到过:Snackbars - Material Design
我真的希望我的 Snackbar 像这样:
我现在得到的是这个:
我的代码是:
final snackBar = SnackBar(
content: Text("Feild(s) are empty!"),
duration: new Duration(seconds: 1),
backgroundColor: Theme.of(context).primaryColor,
);
Scaffold.of(context).showSnackBar(snackBar);
}
Run Code Online (Sandbox Code Playgroud) 由于ProgressDialog已从Android版本O弃用,我仍然找到了更好的方法来完成我的任务.任务是从我的活动转移到片段.一切都工作正常,但progressdialog不可见.我试过实现它但是... progressdialog不起作用.
似乎进度条可以工作但仍然不起作用.我需要一个progressdialog,因为我很容易设置我的标题和消息.我需要一个微调器progressDialog但不知道该怎么做.这是我的一项工作,但没有实施:
Java类
ublic class SaveVideo extends AppCompatActivity {
private Button button;
private ProgressDialog mProgressDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_save_video);
mProgressDialog = new ProgressDialog(this);
getSupportActionBar().setHomeAsUpIndicator(R.drawable.back);
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
button = (Button) findViewById(R.id.saveVideo);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//where it must be seen when the button is pressed
mProgressDialog.setTitle("Title");
mProgressDialog.setMessage("Message");
mProgressDialog.show();
Intent intent = new Intent(SaveVideo.this,MainActivity.class);
intent.putExtra("change",2);
startActivity(intent);
//as soon as the page moves from this to another fragment
mProgressDialog.dismiss();
}
});
} …Run Code Online (Sandbox Code Playgroud) 我以这种方式使用 CheckboxListTile:
\nListTileTheme(\n contentPadding: EdgeInsets.only(right: 20.0),\n child: CheckboxListTile(\n controlAffinity: ListTileControlAffinity.leading,\n value: false,\n onChanged: (value) {},\n title: Text(\n "\xd8\xa7\xd9\x81\xd8\xb2\xd9\x88\xd8\xaf\xd9\x86 \xd8\xa8\xd9\x87 \xd9\x81\xd9\x87\xd8\xb1\xd8\xb3\xd8\xaa \xd9\xbe\xd8\xb1\xda\xa9\xd8\xa7\xd8\xb1\xd8\xa8\xd8\xb1\xd8\xaf\xd9\x87\xd8\xa7"\n ),\n ),\n),\nRun Code Online (Sandbox Code Playgroud)\n其结果是:
\n\n如何减少复选框与其标题之间的间距?
\n我一直在研究这个挑战:Count Triplets,经过大量的努力,我的算法并没有适用于每个测试用例。
由于在讨论中,我看到了一段代码并试图找出代码的真正功能,但我仍然无法理解这段代码是如何工作的。
解决方案:
from collections import defaultdict
arr = [1,3,9,9,27,81]
r = 3
v2 = defaultdict(int)
v3 = defaultdict(int)
count = 0
for k in arr:
count += v3[k]
v3[k*r] += v2[k]
v2[k*r] += 1
print(count)
Run Code Online (Sandbox Code Playgroud)
上面的代码完美地适用于每个测试用例。我已经测试的值k,v2,v3理解,但还是不知道如何代码工作,以便与计数三胞胎顺利。我也无法在梦中想到那个解决方案。我想知道人们如何如此聪明地制定出这个解决方案。尽管如此,如果我能得到正确的解释,我会很高兴。谢谢
k,v2,v3 的输出
from collections import defaultdict
arr = [1,3,9,9,27,81]
r = 3
v2 = defaultdict(int)
v3 = defaultdict(int)
count = 0
for k in arr:
count += v3[k]
v3[k*r] += v2[k]
v2[k*r] += 1 …Run Code Online (Sandbox Code Playgroud) 我一直在合并两个视频。我正在从手机存储中提取视频,并以字符串形式传递它们。然后这些视频被合并。我已经看到,如果我要合并从摄像机拍摄的视频,那么它工作正常,合并进行得很好。但是,一旦获取并尝试合并其他视频文件,就会引发异常
java.io.IOException: Cannot merge AudioSampleEntry{bytesPerSample=0, bytesPerFrame=0, bytesPerPacket=0, samplesPerPacket=0, packetSize=0, compressionId=0, soundVersion=0, sampleRate=24000, sampleSize=16, channelCount=2, boxes=[com.googlecode.mp4parser.boxes.mp4.ESDescriptorBox@fffffab7]} and AudioSampleEntry{bytesPerSample=0, bytesPerFrame=0, bytesPerPacket=0, samplesPerPacket=0, packetSize=0, compressionId=0, soundVersion=0, sampleRate=22050, sampleSize=16, channelCount=2, boxes=[com.googlecode.mp4parser.boxes.mp4.ESDescriptorBox@fffff9fb]} 08-22 15:59:03.347 27476-27558/in.pinelane.myhovi W/System.err: at com.googlecode.mp4parser.authoring.tracks.AppendTrack.mergeStsds(AppendTrack.java:116) 08-22 15:59:03.347 27476-27558/in.pinelane.myhovi W/System.err: at com.googlecode.mp4parser.authoring.tracks.AppendTrack.<init>(AppendTrack.java:59)
Run Code Online (Sandbox Code Playgroud)
并且不会在存储设备中保存任何文件。另外,如果视频的高度不同,那么它会给我这个例外,并且也不会保存任何文件
E/isoparser: AppendTrack:height differs
Run Code Online (Sandbox Code Playgroud)
这是我的活动,您可以看到以下代码:
//asynch task to merge the videos in background
class MergeVideos extends AsyncTask<ArrayList<File>, Integer, String>{
@Override
protected String doInBackground(ArrayList<File>... params) {
ArrayList<Movie> inMovies = new ArrayList<>();
for(File file : params[0]){
Movie movie = MovieCreator.build(file.getAbsolutePath());
inMovies.add(movie);
}
List<Track> …Run Code Online (Sandbox Code Playgroud) 我实际上处于一种非常奇怪的情况,不知何故无法弄清楚我身上发生了什么无意义的事情。情况是我实际上正在很好地实现我的引导工具提示,并且我已经在 上检查过它JsFiddle,它在那里也工作正常,但是,经过大量的努力,它没有在网络项目上实现,我不知道为什么。
这确实很奇怪。这是我的实现,在 JsFiddle 上运行良好。
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- jQuery Script -->
<script src="https://code.jquery.com/jquery-1.12.0.js"></script>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4" crossorigin="anonymous">
<!-- Optional JavaScript -->
<!-- Popper.js, then Bootstrap JS -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function (){
$("[data-toggle=tooltip]").tooltip()
})
</script>
</head>
<body>
<section class="testimonial home-page" id="home">
<div class="container">
<h1>Bringing ease to<br>each home</h1>
<button type="button" class="btn btn-secondary" data-toggle="tooltip" data-placement="bottom" title="Tooltip on bottom"> …Run Code Online (Sandbox Code Playgroud)因此,我有一个文件deploy.sh,它具有外壳程序脚本。既然我知道这一点,我就有一点困惑,那set -x实际上是什么意思。
运行文件后,我观察到在文件中写入的命令在终端中带有+号。
就像我有这个一样
#!/bin/bash
set -x
ng build
Run Code Online (Sandbox Code Playgroud)
所以输出提到了+ng build,当我set -x从文件中注释掉时,一切都会执行,但是后面的命令不会显示在终端中。
我已经对此进行了研究,但是具体找不到该特定命令的真正含义和工作。
我有一个TextField(),我想更改 Underlineinput边框颜色和它的厚度,因为它看起来像厚度。我已经尝试过我的水平来改变它,但它根本不起作用。
我遵循了这些链接,但对我没有任何作用:
到目前为止尝试的是:
代码:
decoration: InputDeocration(
border: UnderlineInputBorder(
borderSide: new BorderSide(
color: Color.fromRGBO(173, 179, 191, 1),
width: 0.5,
style: BorderStyle.none
)
)
)
Run Code Online (Sandbox Code Playgroud)
此处唯一起作用或改变颜色的是focussedBorderand enabledBorder。我不想要这个,所以我期待在这里得到一些好的建议。
它不会改变任何东西。我想要的是:
到目前为止,无论我对设计做了什么更改,我每次都得到的是:
我正在解决这个问题:HackerRank上的 Farudulent Activity Notification。我已经完成了我的代码并且正在工作,但是对于非常大的输入,它也效率低下。
我不知道,但经过我所有的努力,我能够为中等级别的问题提供很好的解决方案,但是
timeout error对于非常大的输入,每次都会发生这种情况。我尝试优化我的代码,但仍然出现超时错误。我对这个问题和即将提出的问题的议程是:
- 如何为非常大的输入提高效率。它需要什么样的智慧。
- 如何达到那个水平。我应该为此准备什么。
- 代码优化
我乐于学习,我真的很想学习如何编写更高级和优化的代码来让自己变得更好。我愿意努力工作。
我的算法:
- 对于这个问题,我们必须从
incrementing variable i直到len(givenArray)-d- 取一个变量作为下一个要比较
iterate的变量,我的情况是变量- 将特定数组的值传递给计数方法
countFraud()- 将其添加到计数变量
- 递增迭代变量
代码:
# this is for counting the trailing array
def countFraud(arr, nextNum):
count = 0
median = 0.0
d = len(arr)
#for calculating the median correctly
arr.sort()
if d%2 != 0:
median = arr[int(d/2)]
else:
n = int(d/2)
median = (arr[n] + arr[n-1]) / 2
#now the opeartion for …Run Code Online (Sandbox Code Playgroud) python sorting functional-programming python-3.x time-limiting
目标:实现具有可见半径和儿童图像的完美尺寸的圆形按钮
从上图可以看出,我尝试了社区在这里提到的许多解决方案
包括:
CircleAvatar(
child: Image.asset('assets/images/gucci.jpg')
)
Run Code Online (Sandbox Code Playgroud)
ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Image.asset(
'assets/images/gucci.jpg',
height: 100.0,
width: 100.0,
)
)
Run Code Online (Sandbox Code Playgroud)
Material(
elevation: 1.0,
shape: CircleBorder(),
clipBehavior: Clip.hardEdge,
color: Colors.transparent,
child: Ink.image(
image: AssetImage('assets/images/gucci.jpg'),
fit: BoxFit.cover,
width: 120.0,
height: 120.0,
child: InkWell(
onTap: () {},
)
)
)
Run Code Online (Sandbox Code Playgroud)
关于如何实现这个设计有什么想法吗?
flutter ×4
android ×2
python-3.x ×2
arrays ×1
bash ×1
html ×1
javascript ×1
merge ×1
mp4parser ×1
python ×1
sh ×1
snackbar ×1
sorting ×1
uitextfield ×1
video ×1