Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android中获取显示器的像素值?_Android_Android Layout - Fatal编程技术网

如何在Android中获取显示器的像素值?

如何在Android中获取显示器的像素值?,android,android-layout,Android,Android Layout,我在寻找一种方法,如何从我的屏幕中提取所选(x,y)的像素值(RGB) (我的显示器包含许多图像,而不仅仅是背景) 谢谢首先,您需要活动的根容器。假设您的活动的xml如下所示: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/container" android:orientation="vertical

我在寻找一种方法,如何从我的屏幕中提取所选(x,y)的像素值(RGB)

(我的显示器包含许多图像,而不仅仅是背景)


谢谢

首先,您需要活动的根容器。假设您的活动的xml如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/container"
             android:orientation="vertical"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

             <!-- All your stuff-->

</RelativeLayout>

首先,您需要活动的根容器。假设您的活动的xml如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/container"
             android:orientation="vertical"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

             <!-- All your stuff-->

</RelativeLayout>

首先,您需要活动的根容器。假设您的活动的xml如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/container"
             android:orientation="vertical"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

             <!-- All your stuff-->

</RelativeLayout>

首先,您需要活动的根容器。假设您的活动的xml如下所示:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/container"
             android:orientation="vertical"
             android:layout_width="match_parent"
             android:layout_height="match_parent">

             <!-- All your stuff-->

</RelativeLayout>

解决方案在这里:我已经检查过了,但是没有找到如何获取值解决方案在这里:我已经检查过了,但是没有找到如何获取值解决方案在这里:我已经检查过了,但是没有找到如何获取值解决方案在这里:我已经检查过了,但是我没有找到如何获取值这个方法在可变像素中返回空值,知道为什么吗?@user3501635 hm,你确定
getPixel
返回空值吗?实际上它不能返回null。这个方法在可变像素中返回null值,知道为什么吗?@user3501635 hm,你确定
getPixel
返回null吗?实际上它不能返回null。这个方法在可变像素中返回null值,知道为什么吗?@user3501635 hm,你确定
getPixel
返回null吗?实际上它不能返回null。这个方法在可变像素中返回null值,知道为什么吗?@user3501635 hm,你确定
getPixel
返回null吗?实际上它不能返回null。