现在,我想在Android应用程序中标识选项卡视图,我尝试使用adb shell dumpsys来转储活动信息,以在选项卡视图中寻找一些常见特征。但是,结果在不同的应用程序中会有所不同。例如,我使用adb shell dumpsys activity package.name
,然后从结果中获得以下信息:
android.widget.TabWidget{3630102 V.E...... ........ 0,2188-1600,2380 #1020013 android:id/tabs}
android.widget.FrameLayout{5023a13 VF....... ........ 0,0-320,192}
android.widget.RelativeLayout{d56b450 V.E...C.. ........ 0,0-320,192 #7f09055a app:id/vgTab}
android.widget.RelativeLayout{ebb5649 V.E...... ........ 100,0-220,192 #7f090518 app:id/vgItem}
android.widget.ImageView{f842b4e V.ED..... ........ 0,32-120,110 #7f090201 app:id/ivTabItem}
android.widget.ImageView{ccc646f G.ED..... ......I. 0,0-0,0 #7f0904da app:id/vCrumb}
android.widget.TextView{67ac57c V.ED..... ........ 24,116-96,165 #7f09042f app:id/tvName}
android.widget.ImageView{45a0e05 G.ED..... ......I. 0,0-0,0 #7f0901c4 app:id/imvVip}
android.widget.FrameLayout{77bae5a VF....... ..S..... 320,0-640,192}
android.widget.RelativeLayout{264d88b V.E...C.. ..S..... 0,0-320,192 #7f09055a app:id/vgTab}
android.widget.RelativeLayout{56cbd68 V.E...... ..S..... 100,0-220,192 #7f090518 app:id/vgItem}
android.widget.ImageView{7728581 V.ED..... ..S..... 0,32-120,110 #7f090201 app:id/ivTabItem}
android.widget.ImageView{3365626 G.ED..... ..S...I. 0,0-0,0 #7f0904da app:id/vCrumb}
android.widget.TextView{3c67267 V.ED..... ..S..... 24,116-96,165 #7f09042f app:id/tvName}
android.widget.ImageView{5044814 G.ED..... ..S...I. 0,0-0,0 #7f0901c4 app:id/imvVip}
android.widget.FrameLayout{440f8bd VFE...C.. ........ 640,0-960,192}
android.widget.RelativeLayout{aa1aeb2 V.E...... ........ 0,0-320,192 #7f09055a app:id/vgTab}
android.widget.RelativeLayout{9bdce03 V.E...... ........ 99,0-221,192 #7f090518 app:id/vgItem}
android.widget.ImageView{3e7d180 V.ED..... ........ 0,32-122,110 #7f090201 app:id/ivTabItem}
android.widget.ImageView{48963b9 G.ED..... ......I. 0,0-0,0 #7f0904da app:id/vCrumb}
android.widget.TextView{4f803fe V.ED..... ........ 33,116-89,165 #7f09042f app:id/tvName}
android.widget.ImageView{345475f G.ED..... ......I. 0,0-0,0 #7f0901c4 app:id/imvVip}
android.widget.FrameLayout{2b885ac VF....... ........ 960,0-1280,192}
android.widget.RelativeLayout{538275 V.E...C.. ........ 0,0-320,192 #7f09055a app:id/vgTab}
android.widget.RelativeLayout{cc620a V.E...... ........ 100,0-220,192 #7f090518 app:id/vgItem}
android.widget.ImageView{aa0fa7b V.ED..... ........ 0,32-120,110 #7f090201 app:id/ivTabItem}
android.widget.ImageView{8fe5098 G.ED..... ......ID 81,21-102,42 #7f0904da app:id/vCrumb}
android.widget.TextView{e66d0f1 V.ED..... ........ 24,116-96,165 #7f09042f app:id/tvName}
android.widget.ImageView{d694d6 G.ED..... ......I. 0,0-0,0 #7f0901c4 app:id/imvVip}
android.widget.FrameLayout{cd3de44 VF....... ........ 1280,0-1600,192}
android.widget.RelativeLayout{868b2d V.E...C.. ........ 0,0-320,192 #7f09055a app:id/vgTab}
android.widget.RelativeLayout{97f2862 V.E...... ........ 100,0-220,192 #7f090518 app:id/vgItem}
android.widget.ImageView{73e3df3 V.ED..... ........ 0,32-120,110 #7f090201 app:id/ivTabItem}
android.widget.ImageView{9529ab0 G.ED..... ......I. 0,0-0,0 #7f0904da app:id/vCrumb}
android.widget.TextView{76dad29 V.ED..... ........ 24,116-96,165 #7f09042f app:id/tvName}
android.widget.ImageView{b2b68ae G.ED..... ......I. 0,0-0,0 #7f0901c4 app:id/imvVip}
我的想法是,它包含选项卡视图,但不能在其他应用程序中使用。似乎并非每个应用程序都具有这样的信息。所以我想知道有什么方法可以识别android应用中的标签视图,无论使用adb还是分析单击标签时的行为都不同于单击普通视图(例如,使用tab + fragment时,我们可以在我们单击一个视图,当前片段会发生变化)或其他。谢谢!