2012-02-22 62 views
0

怎么可能做到这样的事情,比如在Android上的任何其他活动之上的“水印”?Android屏幕“嵌入水印”

详细:I need to show some message on top of everything what is running on my device。无论这是游戏,电影,应用程序。

  1. 是否可以在Android上实现某些功能?我的手机扎根了。

  2. 是否可以使用一些OpenGL功能?

回答

-1

是的,可以运行基本活动并执行一些预期活动来执行所需的操作。

现在,您可以使用android中的子活动和活动的概念来确保这种类型的结果。

+0

这是否与ICS中的某些“顶部”输出(设置 - >开发人员选项 - >显示CPU使用率)相同? – user1226277 2012-02-22 21:21:00

1

使用此代码。

起初,我在这里使用FrameLayout,这是透明的,你可以看到图像上的“水印”文本。

第二,我在我的按钮上使用了android:background="#99 000000",您也可以在图像上看到它。据我所知,前两位数字命名为alpha通道,您可以将它们设置为0到ff; 0是完全透明的,ff是不透明的,像往常一样。

我认为你有这个想法,或者你可以在画布上绘制自定义图像,放在你的framelayout上并设置50%trasparent背景。而且你必须在所有布局上做50%的透明图层,所以所有的活动都会有水印。

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/frameLayout1" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <FrameLayout 
     android:id="@+id/frameLayout2" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" > 

     <ImageView 
      android:id="@+id/imageView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="left" 
      android:src="@drawable/ic_launcher" /> 
    </FrameLayout> 

    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:orientation="vertical" > 

     <TextView 
      android:id="@+id/textView1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="TextView" /> 

     <Button 
      android:id="@+id/button1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Button" 
      android:background="#99000000" /> 

    </LinearLayout> 

</FrameLayout> 
+0

这可能会影响开发人员自己的应用程序,但不适用于任意其他应用程序。 – CommonsWare 2012-02-22 19:48:21

+0

哦,是的,我的不好。所以,如果可能的话,我们可以创建一个病毒,例如,色情图片设置非透明背景。用户无法看到任何东西,只有我们的图片。听起来很有趣。所以这似乎不可能? – 2012-02-22 20:20:52

+0

@ m9_psy:当然我们可能会制造一种病毒,但这并不是问题,我们可以用这个做什么,但是如果我们能做到这一点? – user1226277 2012-02-22 21:13:22

0

使用根据你的布局的主活动。然后通过扩展到子活动来在其他活动中使用此主活动。 它很简单。