1package com.android.test.hierarchyviewer;
2
3import android.app.Activity;
4import android.os.Bundle;
5import android.util.Log;
6import android.view.Menu;
7import android.view.MenuItem;
8import android.view.View;
9
10
11public class MainActivity extends Activity {
12    private static final String TAG = "Main";
13
14    @Override
15    protected void onCreate(Bundle savedInstanceState) {
16        super.onCreate(savedInstanceState);
17        setContentView(R.layout.activity_main);
18
19        View textView = findViewById(R.id.textView);
20        Log.d(TAG, "x, y = " + textView.getX() + ", " + textView.getY());
21    }
22
23    @Override
24    public boolean onCreateOptionsMenu(Menu menu) {
25        // Inflate the menu; this adds items to the action bar if it is present.
26        getMenuInflater().inflate(R.menu.menu_main, menu);
27        return true;
28    }
29
30    @Override
31    public boolean onOptionsItemSelected(MenuItem item) {
32        // Handle action bar item clicks here. The action bar will
33        // automatically handle clicks on the Home/Up button, so long
34        // as you specify a parent activity in AndroidManifest.xml.
35        int id = item.getItemId();
36
37        //noinspection SimplifiableIfStatement
38        if (id == R.id.action_settings) {
39            return true;
40        }
41
42        return super.onOptionsItemSelected(item);
43    }
44}
45