The import com.android.internal.R cannot be resolved

后端 未结 4 828
悲&欢浪女
悲&欢浪女 2020-12-29 09:08

Hi i am working with Gestures and i need to import but i m getting error

com.android.internal.R;

The import com.android.internal.R

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2020-12-29 09:20

    Yes you can use the internal R with some dirty trick (dirty trick = Java reflection).

    Just an example:

    Class clasz = Class.forName("com.android.internal.R$styleable")
    Field field = clasz.getDeclaredField("TextAppearance");
    field.setAccessible(true);
    int[] textAppearanceStyleArr = (int[])field.get(null);
    
    field = clasz.getDeclaredField("TextAppearance_textSize");
    field.setAccessible(true);
    int textSizeStyle = (Integer)field.get(null);
    

提交回复
热议问题