Created
February 2, 2011 06:19
-
-
Save anonymous/807320 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.make; | |
import android.app.Activity; | |
import android.graphics.Color; | |
import android.os.Bundle; | |
import android.view.MotionEvent; | |
import android.widget.TextView; | |
public class xxxAct extends Activity { | |
TextView q; | |
TextView w; | |
TextView tv; | |
/** Called when the activity is first created. */ | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
q=(TextView)findViewById(R.id.q); | |
w=(TextView)findViewById(R.id.w); | |
tv=(TextView)findViewById(R.id.tv); | |
} | |
@Override | |
public boolean onTouchEvent (MotionEvent motionEvent) | |
{ | |
int action = motionEvent.getAction (); | |
//int currentX = (int) motionEvent.getX (); | |
//int currentY = (int) motionEvent.getY (); | |
/*if(action==MotionEvent.ACTION_DOWN) | |
{ | |
t.setText(""); | |
}*/ | |
if (action == MotionEvent.ACTION_MOVE) | |
{ | |
int currentX = (int) motionEvent.getX (); | |
if(currentX>q&¤tX<q.getWidth()){//same condition for y | |
q.setBackgroundResource(R.drawable.white_border); | |
q.setTextColor(Color.WHITE); | |
} | |
} | |
/* | |
if(action==MotionEvent.ACTION_UP) | |
{ | |
setContentView(R.layout.main); | |
t.setText(""); | |
}*/ | |
return true; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:orientation="horizontal" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" | |
> | |
<TextView | |
android:layout_width="30px" | |
android:layout_height="30px" | |
android:id="@+id/q" | |
android:text="Q" | |
android:textColor="#000000" | |
android:layout_marginLeft="25px" | |
android:background="#d3d3d3" | |
/> | |
<TextView | |
android:layout_width="30px" | |
android:layout_height="30px" | |
android:id="@+id/w" | |
android:text="W" | |
android:textColor="#000000" | |
android:background="#d3d3d3" | |
/> | |
</LinearLayout> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment