小编Get*_*k99的帖子

如何只允许EditText中的正数

我有一个TextWatcher,当所有EditTexts length()都是!= 0时启用一个按钮.我现在想要添加能力以确保数字是正数.我尝试在另一个if()中放入一个新的if()来检查是否> 0但是由于某种原因它不起作用.

所以我需要的是确保所有的EditText都不为空,并且输入了正数,然后启用该数字.

这就是我的意思,

    public TextWatcher localWatcher = new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count,
            int after) {
    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before,
            int count) {
    }

    // When the text is edited, I want to check if all textViews are filled
    @Override
    public void afterTextChanged(Editable s) {

        // Check if any of the TextViews are == 0, if so the button remains disabled
        if      (et1local.getText().toString().length() == 0 …
Run Code Online (Sandbox Code Playgroud)

java android textwatcher

12
推荐指数
1
解决办法
1万
查看次数

使用HTML <img>标记代替CSS background-image属性作为背景图像?

我需要将html <img>标记用作的背景图像<div>。然后,我将在其上放置一个<p>内容。我已经尝试过了,但是似乎无法正确显示它们。我使用了相对位置,负值的边距。

任何建议或指出我正确的方向将不胜感激。

<div>

  <img src="http://www.shiaupload.ir/images/77810787432153420049.png" />

  <p>
    Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book
  </p>

</div>
Run Code Online (Sandbox Code Playgroud)

html css image

3
推荐指数
2
解决办法
6147
查看次数

将序列化对象写入文件中?

try
        {
            File dataFile = new File("C:/Users/keatit/Desktop/players.txt");
            if(!dataFile.exists())
            {
                dataFile.createNewFile();
            }

            FileOutputStream fos = new FileOutputStream("C:/Users/keatit/Desktop/players.txt");
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(players);
            oos.close();
        }
        catch(FileNotFoundException fnfex)
        {
            System.out.println(fnfex.getMessage());
        }
        catch(IOException ioex)
        {
            System.out.println(ioex.getMessage());
        }
Run Code Online (Sandbox Code Playgroud)

我有一个实现Serializable的类播放器,但是当我将文件写入文件时,文本被搞砸了,如下所示.任何帮助将非常感激.谢谢.

"¬íssrjava.util.ArrayListxÒ™ÇaIsizexp wsrplars.playerÌ`~%×êòœIageL firstNamet Ljava/lang/String; xp t Trevorsq~t Michaelax"

java file

0
推荐指数
1
解决办法
63
查看次数

标签 统计

java ×2

android ×1

css ×1

file ×1

html ×1

image ×1

textwatcher ×1