小编Coc*_*ess的帖子

如何创建透明按钮?

我正在尝试创建一个透明的按钮.在细节中,我用图像设置背景的按钮,我想修改按钮的透明度,以便查看背景布局的颜色.

android android-widget android-layout android-button

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

声纳:如何使用try-with-resources关闭FileOutputStream

声纳给出了一个错误,FileOutputStream应该将其关闭。我需要修改以下代码才能使用try-with-resources。我该怎么做呢?

public void archivingTheFile(String zipFile){
    byte[] buffer = new byte[1024];
    try{
        FileOutputStream fos = new FileOutputStream(zipFile);
        ZipOutputStream zos = new ZipOutputStream(fos);
        for(String file : this.fileList){
            ZipEntry ze= new ZipEntry(file);
            zos.putNextEntry(ze);
            FileInputStream in = new FileInputStream(SOURCE_FOLDER + File.separator + file);
            int len;
            while ((len = in.read(buffer)) > 0) {
                zos.write(buffer, 0, len);
            }
            in.close();
        }
        zos.closeEntry();
        zos.close();
    }catch(IOException ex){
        LOGGER.error("Exception occurred while zipping file",ex);
    }
}
Run Code Online (Sandbox Code Playgroud)

java java-io try-with-resources sonarqube

3
推荐指数
1
解决办法
6784
查看次数

Android布局有4个方块,每个方块内有一个按钮

我想创建4个正方形,在每个正方形中我想创建一个小按钮.广场必须是可见的,并且必须有边框.

我知道如何创建4个按钮作为正方形但我不知道如何在每个正方形周围创建边框.但我想要与尺寸无关,现在按钮非常大......

我的例子

<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_height="fill_parent" android:layout_width="fill_parent">
    <RelativeLayout android:id="@+id/magaLoginLayout"
        android:layout_height="fill_parent" android:layout_width="fill_parent">
        <Button android:text="@+id/Button01" android:id="@+id/Button01"
            android:layout_width="160dip" android:layout_height="160dip" android:layout_marginTop="20dip"></Button>
        <Button android:text="@+id/Button03" android:layout_below="@+id/Button01" android:id="@+id/Button03"
            android:layout_alignLeft="@+id/Button01" android:layout_height="160dip" android:layout_width="160dip"></Button>
        <Button android:text="@+id/Button04" android:layout_below="@+id/Button01" android:id="@+id/Button04"
            android:layout_toRightOf="@+id/Button03" android:layout_height="160dip" android:layout_width="160dip"></Button>
        <Button android:text="@+id/Button02" android:id="@+id/Button02" android:layout_width="wrap_content"
            android:layout_toRightOf="@+id/Button01" android:layout_alignTop="@+id/Button01" android:layout_alignParentRight="true" android:layout_height="160dip"></Button>


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

在此输入图像描述

android android-layout

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

android如何在按钮单击时导航网站

当我单击我的 android 应用程序中的按钮时,我想导航到 facebook 粉丝页面。我是安卓新手。任何人都可以帮助我做到这一点。

android android-intent android-button

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