I want put an image and IN FRONT a countdown(first appear Countdown and down of countdown will appear an image)
I have this code:
new CountDownTimer(30000, 1000) {
public void onTick(long millisUntilFinished) {
mTextField.setText("seconds remaining: " + millisUntilFinished / 1000);
}
public void onFinish() {
mTextField.setText("done!");
}
}.start();
This is the countdown, but when i put an image, countdown appear down of image, and i don´t see the countdown D: Thanks and sorry for my english :)
You can easily solve this using a RelativeLayout in your layout xml file.
First, set the ImageView, then align the TextView accordingly, using the id of the ImageView. The result will be a ImageView with an overlayed TextView.
In the example below, the TextView is aligned to the left of the ImageView, using layout_alignLeft="@+id/image"
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/icon" />
<TextView
android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/image"
android:text="My Countdown"
/>
</RelativeLayout>