如何做到这样的事情,比如Android上任何其他活动的“水印”?
详细信息:I need to show some message on top of everything what is running on my device
。无论这是游戏,电影,应用程序。
可以在Android上获得一些东西吗?我的手机扎根了。
可以使用一些OpenGL功能吗?
答案 0 :(得分:1)
使用此代码。
首先,我在这里使用FrameLayout
,这是透明的,您可以在图像上看到“水印”文字。
第二,我在按钮上使用android:background="#99 000000"
,你也可以在图像上看到它。据我所知,前2位数字命名为alpha通道,您可以将它们设置为0到ff; 0是完全透明的,并且ff像往常一样是不透明的。
我认为你明白了或者可能是你可以在画布上绘制自定义图像,放在framelayout上并设置50%trasparent-background。而且你必须在你的所有布局上做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>
答案 1 :(得分:0)
使用具有根据您的布局的主活动。然后通过扩展到子活动在其他活动中使用此主活动。 很简单。
答案 2 :(得分:-1)
是的,可以运行基本活动以及某些预期活动来执行您想要的操作。
现在,您可以在android中使用子活动和活动的概念来确保此类结果。