I put in a stopwatch png, and I am trying to design it right now but when I place the chronometer I cant see it overtop the image. Color isn't the issue so it isn't blending in. I tried making the background of the chronometer the same as the image but still nothing. I see it once I move it away from image, but not where I want it.
<Chronometer
android:id="@+id/chronometer"
android:format="%s"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="40sp"
android:textColor="#ffffff"
android:background="@drawable/stopwatch2"
android:layout_alignTop="@+id/my_button"
android:layout_alignLeft="@+id/my_button"
android:layout_alignStart="@+id/my_button" />
<Button
android:id="@+id/my_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/stopwatch2"
android:text=" "
android:layout_marginTop="71dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true" />
MAIN ACTIVITY
public class MainActivity extends AppCompatActivity {
Chronometer mChronometer;
private int loop = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setClick();
}
public void setClick() {
Button button;
mChronometer = (Chronometer) findViewById(R.id.aChronometer);
// Watch for button clicks.
button = (Button) findViewById(R.id.stopWatch);
button.setOnClickListener(mStartListener);
button = (Button) findViewById(R.id.stopWatch);
button.setOnClickListener(mStartListener);
button = (Button) findViewById(R.id.stopWatch);
button.setOnClickListener(mStartListener);
}
View.OnClickListener mStartListener = new OnClickListener() {
public void onClick(View v) {
if (loop == 0) {
mChronometer.setBase(SystemClock.elapsedRealtime());
mChronometer.start();
loop++;
} else if (loop == 1) {
mChronometer.stop();
loop++;
} else if (loop == 2) {
mChronometer.setBase(SystemClock.elapsedRealtime());
loop = 0;
}
}
};