大佬教程收集整理的这篇文章主要介绍了java android getResources()。getIdentifier(),大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
问题似乎是您要转换drawerSELEction
为小写字母。在R.java文件中很明显,标识符的大小写得以保留。尝试致电:
int panelID = this.getresources().getIDentifIEr(drawerSELEction,"ID",getActivity().getPackagename());
如何从R.获取ID的int id值?当我使用getIdentifier
它的正好回报0
。
int i = getArguments().geTint(SELECTION_numbER);
String drawerSELEction = getresources().getStringArray(R.array.drawerSELEction_array)[i];
int panelId = this.getresources().getIdentifier(drawerSELEction.toLowerCase(),"id",getActivity().getPackagename());
编辑
Xml
<LinearLayout xmlns:android="http://scheR_546_11845@as.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/Bus_schedules"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
日志
06-10 21:24:30.372: I/System.out(3572): SELEction = Bus_schedules
06-10 21:24:30.372: I/System.out(3572): panelId = 0
R.java
public static final class id {
public static final int Bus_schedules=0x7f090004;
public static final int basemenu=0x7f090005;
public static final int content_frame=0x7f090001;
public static final int drawer_layout=0x7f090000;
public static final int left_drawer=0x7f090002;
以上是大佬教程为你收集整理的java android getResources()。getIdentifier()全部内容,希望文章能够帮你解决java android getResources()。getIdentifier()所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。