如何在Android中获取显示器的像素值?
我在寻找一种方法,如何从我的屏幕中提取所选(x,y)的像素值(RGB) (我的显示器包含许多图像,而不仅仅是背景)如何在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
谢谢首先,您需要活动的根容器。假设您的活动的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。