Viewの中身をLogで確認できるViewDebugのdumpCapturedViewが便利
使用例
MainActivity.java
. . . @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button b = (Button) findViewById(R.id.button1); // こいつ ViewDebug.dumpCapturedView("SAMPLE_TAG", b); } . . .
Logには
D/SAMPLE_TAG﹕ android.widget.Button: getBottom()=0; getContext()=com.tatuas.android.sample.MainActivity@425f5d20; getHint()=null; getId()=2131230720; getLeft()=0; getRight()=0; getText()=; getTop()=0;
といった感じで出力される。