I have a RelativeLayout
which has a drawable background. How do I convert the background drawable into a bitmap so I can use it to get
View.OnTouchListener llTouch = new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
x = (int)event.getX();
y = (int)event.getY();
int action = event.getAction();
int pixel = bitmap.getPixel((int)x,(int) y);
}
My XML is like this:
<RelativeLayout
android:id="@+id/rlColorSpect"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/palette2" >
<ImageView
android:id="@+id/ivSquare"
android:layout_width="@dimen/title_text_pad"
android:layout_height="@dimen/title_text_pad"
android:layout_alignParentBottom="true"
android:scaleType="fitXY"
android:src="@drawable/esquare" />
</RelativeLayout>