Ejemplo n.º 1
0
        @Override
        public void onClick(View v) {
          Log.i("MainActivity", "onClick");

          switch (v.getId()) {
            case R.id.button:
              String msg = editText.getText().toString();
              if (msg == null || msg.isEmpty()) return;
              result.setText(msg);
              ruler.scrollToTime(msg);
            case R.id.button2:
              msg = editText2.getText().toString();
              if (msg == null || msg.isEmpty()) return;
              ruler2.scrollTo(msg);
              break;
          }
        }
Ejemplo n.º 2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    ruler = (Ruler) findViewById(R.id.ruler);
    result = (TextView) findViewById(R.id.result_text);
    ruler.setRulerTag("时间轴demo");
    ruler.setRulerHandler(rulerHandler);
    editText = (EditText) findViewById(R.id.edit_text);
    button = (Button) findViewById(R.id.button);
    button.setOnClickListener(clickListener);

    ruler2 = (Ruler) findViewById(R.id.ruler2);
    ruler2.setRulerTag("刻尺demo");
    result2 = (TextView) findViewById(R.id.result_text2);
    ruler2.setRulerHandler(rulerHandler2);
    editText2 = (EditText) findViewById(R.id.edit_text2);
    button2 = (Button) findViewById(R.id.button2);
    button2.setOnClickListener(clickListener);
  }