0

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;
        }
    }
};
BadCoder
  • 141
  • 1
  • 16
  • Can you provide the rest of the code? –  Oct 27 '15 at 20:44
  • It's just code to start, stop and reset the chrono. No other thing in my code has anything to do with the images – BadCoder Oct 27 '15 at 21:32
  • In order for us to recreate what you are seeing and work with it we need the code, or we can't help you. –  Oct 27 '15 at 21:39
  • sorry it took awhile I am just lost in thought after i start googling other stuff and forget I posted this. Also the background is just the background you get when you start a project. If you need to know that idk. – BadCoder Oct 27 '15 at 22:20

0 Answers0