小编dr.*_*oom的帖子

如何在Android上使LayerDrawable(图层列表项)不可见?

我在xml文件中定义了一个包含几个项目的图层列表.项目显示确定我希望每隔五秒左右其中一个图层变得不可见.

例如,它适用于简单的textview,但不适用于LayerDrawable中的Layer

final private Runnable runnable = new Runnable() {
    public void run() {
        LayerDrawable myDrawable= (LayerDrawable)getResources().getDrawable(R.drawable.all_layers);
        Drawable layer =  myDrawable.findDrawableByLayerId(R.id.interesting_layer);
        if (layer.isVisible()==true)
        {
            layer.setVisible(false, false);
        }
        else
        {
            layer.setVisible(true, false);
        }
        TextView txt = (TextView) findViewById(R.id.txtTest);
        if (txt.getVisibility()==0)
        {
            txt.setVisibility(4);
        }
        else
        {
            txt.setVisibility(0);
        }
        handler.postDelayed(this, 5000);
    }
};
Run Code Online (Sandbox Code Playgroud)

我是否尝试以错误的方式获取图层的ID(我从这里找到了它......)?提前致谢!

android visibility view layer

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

如何使用OpenSSL编译简单程序?

我正在尝试编译一个简单的ssl程序(它取自openssl书的源代码)。该程序具有以下文件:common.h common.c client.c server.c

我已经安装了openssl 0.9.7,因此与本书具有相同的版本。我已经下载了源代码并在主目录中进行./Configure、make、make test,make install。

common.h中包括以下内容:

#include <openssl/bio.h>
#include <openssl/err.h>
#include <openssl/rand.h>
#include <openssl/ssl.h>
#include <openssl/x509v3.h> 
Run Code Online (Sandbox Code Playgroud)

我运行gcc -Wall common.c client.c -o client但出现以下错误:

common.c: In function ‘init_OpenSSL’:
common.c:12:5: warning: implicit declaration of function ‘THREAD_setup’
/tmp/ccvI3HX4.o: In function `handle_error':
common.c:(.text+0x3a): undefined reference to `ERR_print_errors_fp'
/tmp/ccvI3HX4.o: In function `init_OpenSSL':
common.c:(.text+0x51): undefined reference to `THREAD_setup'
common.c:(.text+0x5a): undefined reference to `SSL_library_init'
common.c:(.text+0x97): undefined reference to `SSL_load_error_strings'
/tmp/ccRA0Co9.o: In function `do_client_loop':
client.c:(.text+0x71): undefined reference to `BIO_write'
/tmp/ccRA0Co9.o: In function `main':
client.c:(.text+0xbb): …
Run Code Online (Sandbox Code Playgroud)

c++ gcc openssl compilation ld

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

在R中绘图时如何获得静态轴值?

我使用以下代码:

x <-sample(1:100, 10);
y <-sample(1:100, 10);
plot(x,y);
Run Code Online (Sandbox Code Playgroud)

但我试图在x,y轴上创建一个静态值的图.问题在于,有时x轴例如在图上呈现0到80的值范围,而其他从20到100的值取决于x内的随机值.

无论x和y矩阵内的值如何,我希望x,y在所有情况下的绘图中都有0到100的值.

有没有办法实现这个目标?

提前致谢!

plot r

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

标签 统计

android ×1

c++ ×1

compilation ×1

gcc ×1

layer ×1

ld ×1

openssl ×1

plot ×1

r ×1

view ×1

visibility ×1