Java Code:
private void hintMethod(){
final Dialog dialog = new Dialog(GMTActivity.this);
dialog.setContentView(R.layout.thinking_ui);
dialog.setTitle(" Guess My THink!! ");
dialog.setCancelable(false);
dialog.setCanceledOnTouchOutside(false);
thinkImageView = (ImageView) dialog.findViewById(R.id.thinkImageView);
buttonTK = (Button) dialog.findViewById(R.id.buttonTK);
thinkingTextView = (TextView) dialog.findViewById(R.id.thinkingTextView);
thinkingTextView.setSingleLine(false);
thinkingTextView.setText("I am thinking between \n"+minNumber+" and "+maxNumber);
thinkImageView.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
buttonTK.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
dialog.show();
}
Xml file:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/thinkImageView"
android:layout_width="69dp"
android:layout_height="58dp"
android:layout_x="10dp"
android:layout_y="1dp"
android:src="@drawable/icon" />
<TextView
android:id="@+id/thinkingTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="82dp"
android:layout_y="18dp"
android:text="thinking 1 to 12" />
<Button
android:id="@+id/buttonTK"
android:layout_width="96dp"
android:layout_height="wrap_content"
android:layout_x="76dp"
android:layout_y="63dp"
android:text=" Ok " />
</AbsoluteLayout>
No comments:
Post a Comment