1 package com.android.test.hierarchyviewer;
2 
3 import android.app.Activity;
4 import android.os.Bundle;
5 import android.util.Log;
6 import android.view.Menu;
7 import android.view.MenuItem;
8 import android.view.View;
9 
10 
11 public class MainActivity extends Activity {
12     private static final String TAG = "Main";
13 
14     @Override
onCreate(Bundle savedInstanceState)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
onCreateOptionsMenu(Menu menu)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
onOptionsItemSelected(MenuItem item)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