在向Android按钮添加颜色后,它会失去其涟漪效果,使用户感觉有响应点击.我该如何解决?我已经搜索了很多解决方案,但我找不到一个不明确的明确解决方案.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ClockInOutFragment">
<AnalogClock
android:id="@+id/clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/date_and_time"/>
<RelativeLayout
android:id="@+id/date_and_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<TextView
android:id="@+id/time_digits"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="12:10"
android:textSize="45sp"/>
<TextView
android:id="@+id/am_pm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/time_digits"
android:layout_toRightOf="@+id/time_digits"
android:paddingLeft="3dp"
android:text="PM"
android:textSize="20sp"/>
<TextView
android:id="@+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/time_digits"
android:text="Mon, July 11"
android:textSize="22sp"/>
</RelativeLayout>
<!--Clock in and out buttons-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:orientation="horizontal">
<Button
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="56dp"
android:layout_weight="1"
android:background="#4CAF50"
android:gravity="center"
android:text="Clock In"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="#FFFFFF"/>
<!--Divider between the clock in and out button-->
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:background="#B6B6B6"/>
<Button …
Run Code Online (Sandbox Code Playgroud) 由于某种原因,我的for循环不会在我的CapitalizeFirstSentence方法中终止.我在那一行设置一个断点,条件(i!= -1)未完成,所以循环应该终止,但它不会!
当我使用(i> 0)条件时它起作用.
我不确定这里发生了什么.
import javax.swing.JOptionPane;
public class SentenceCapitalizer {
//Main Method
public static void main(String[] args) {
String input; //creates a String to hold keyboard input
//Prompt the user to enter a String using JOptionPane and set it equal to input
input = JOptionPane.showInputDialog("Enter a string. ");
//Display the new String with the first letter of each sentenced capitalized
JOptionPane.showMessageDialog(null, CapitalizeFirstSentence(input));
//Exit the program
System.exit(0);
}
//Capitalize first letter of each sentence
public static String CapitalizeFirstSentence(String in)
{ …
Run Code Online (Sandbox Code Playgroud) 如何更改我的git主文件夹?目前我的git文件夹位于我的%AppData%文件夹中.我将项目存储在我的C:\ Projects文件夹中.我希望我的git bash在我的C:\ Projects文件夹中启动,每当我cd到我的主目录(cd~)时,我希望它导航到C:\ Projects.
我在 NetBeans 上看到一个消息:“if 语句是多余的”
我想知道这两个如何相等
public boolean isVowel(char in)
{
char temp = Character.toLowerCase(in);
if (temp == 'a' || temp == 'e' || temp == 'i' || temp == 'o' || temp == 'u')
{
return true;
}
else
{
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
和
public boolean isVowel(char in)
{
char temp = Character.toLowerCase(in);
return temp == 'a' || temp == 'e' || temp == 'i' || temp == 'o' || temp == 'u';
}
Run Code Online (Sandbox Code Playgroud)
我可以看到如果元音之一与 temp 匹配,它将如何返回 true。但是,我不知道它如何返回 false。如果没有满足任何条件,它会直接返回 …
Entry.h
:
//returns the sum of all non mega entry percentages
float sumOfNonMegaEntryPct(vector<Number>& arg1_Numbers);
Run Code Online (Sandbox Code Playgroud)
Entry.cpp
:
//returns the sum of all mega entry percentages
float Entry::sumOfMegaEntryPct(vector<MegaNumber>& arg1_MegaNumbers)
{
float sumPct = 0.00f;
for (MegaNumber c : megaEntry)
{
sumPct = sumPct + arg1_MegaNumbers[c.getID()].getOccurencePct();
}
return sumPct;
}
Run Code Online (Sandbox Code Playgroud)
Lotto.h
:
public:
//compares two entries, used for sorting algorithm, sorts by nonmega number
bool compareEntry_sumPct_nonMega(Entry arg1, Entry arg2);
protected:
vector<Numbers> numbers;
vector<MegaNumbers> megaNumbers;
Run Code Online (Sandbox Code Playgroud)
Lotto.cpp
:
#include "lotto.h"
//sorts nonmega numbers by sum …
Run Code Online (Sandbox Code Playgroud) 我尝试过使用std::random_shuffle
和std::shuffle
,但是他们只是在第一个和最后一个之间洗牌,而不是最后一个.有没有办法改组包含最后一个元素的数组(向量)?
//NumberGenerator.h
#ifndef __NUMBERGENERATOR_H__
#define __NUMBERGENERATOR_H__
#pragma once
#include "Number.h" //regular numbers
#include "MegaNumber.h" //mega numbers
#include <vector> //<vector>
#include <string> //strings
using std::to_string; //convert int to strings
#include <algorithm> //shuffle
//#include <random> //std::default_random_engine
#define NON_MEGA_COMBINATIONS 5
#define MEGA_COMBINATIONS 1
using std::vector; //<vectors>
using std::string; //string
using std::random_shuffle; //shuffles arrays
class NumberGenerator
{
public:
NumberGenerator(vector<Number> numbers, vector<MegaNumber> megaNumbers); //constructor
~NumberGenerator();
string pickNumbers(); //function that randomizes regularDraws and megaDraws
protected:
vector<Number> regularDraws; //contains number information
vector<MegaNumber> megaDraws; …
Run Code Online (Sandbox Code Playgroud) 例如..如果我有.
#include <iostream>
using namespace std;
int main()
{
int counter = 0;
while (true)
{
cout << counter << endl;
counter++
}
}
Run Code Online (Sandbox Code Playgroud)
并且说我在与其他计算机竞争10亿的竞争中,这个循环的运行速率纯粹取决于计算机处理器的速度?或者我的程序运行速度有限制,这可能是多变的?