由网友(② β、小 青 年ヾ)分享简介:我要显示的setContentView(R.layout.main)用于布局的路径; 。因此,如果手机是正常MDPI ,我需要显示路径为:/ RES /布局正常MDPI,或者如果手机是正常华电国际,我需要一个文本路径是:/ RES /布局正常华电国际。 基本上,我需要知道哪些布局文件加载和它的路径。 解决方案 您可以在...
我要显示的setContentView(R.layout.main)用于布局的路径;
。因此,如果手机是正常MDPI
,我需要显示路径为:/ RES /布局正常MDPI,或者如果手机是正常华电国际
,我需要一个文本路径是:/ RES /布局正常华电国际。
基本上,我需要知道哪些布局文件加载和它的路径。
解决方案您可以在XML结果中添加隐藏文本视图具有相应文件夹名称通过搜索
获得文本视图字符串 TextView的路径=(TextView中)findViewbyid(R.id.hiddentextview); 字符串s = path.gettext()的ToString()。
请确保文本视图的所有ID是一样的示例
如果您的XML是`在隐藏的TextView硬code`正常mdpi`正常mdpi`如果您的XML是`在隐藏的TextView硬code`大mdpi`大mdpi`
I need to display the path of layout used in setContentView(R.layout.main);
. So if the mobile phone is normal-mdpi
, I need to display "Path is: /res/layout-normal-mdpi" or if the mobile phone is normal-hdpi
, I need a text "Path is: /res/layout-normal-hdpi".
I basically need to know which layout file was loaded and its path.
解决方案You can add a Hidden Text View with corresponding Folder names in the xml Get the String in the text view by
TextView path = (TextView)findViewbyid(R.id.hiddentextview);
String s = path.gettext().tostring();
Make sure that all the id's of the text view are same Example
if your xml is in `normal-mdpi` in hidden textview hard code `normal-mdpi`
if your xml is in `large-mdpi` in hidden textview hard code `large-mdpi`
相关推荐
最新文章