zoukankan      html  css  js  c++  java
  • 关于R.styleable的问题

    原文:http://wang-peng1.iteye.com/blog/806225

    原来想直接想调用程序的东西,但是使用R.styleable的时候 eclipse不能解析了,后来发现原来被删除了此方法

    Java代码  收藏代码
    1. public ImageAdapter(Context c) {  
    2.     mContext = c;  
    3.     TypedArray a = obtainStyledAttributes(android.R.styleable.Theme);  
    4.     mGalleryItemBackground = a.getResourceId(  
    5.             android.R.styleable.Theme_galleryItemBackground, 0);  
    6.     a.recycle();  
    7. }  

     这种方法也就不能用了

    然后

    public ImageAdapter(Context c) {
        mContext = c;
        TypedArray a = c.obtainStyledAttributes(R.styleable.Gallery1);
        mGalleryItemBackground = a.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 0);
        a.recycle();
    }

    唯一要做的就是自己去做一个styleable

    resvalues 

    <?xml version="1.0" encoding="utf-8"?> 
    <resources> 
        <declare-styleable name="Gallery1"> 
            <attr name="android:galleryItemBackground" /> 
        </declare-styleable> 
    </resources>
  • 相关阅读:
    Spring使用@Value注解各种类型的值
    Jdom生成xml文件时的特殊字符问题
    将博客搬至CSDN
    ubuntu/mint添加字体
    linux保持ssh连接
    servlet 重定向与转发区别
    u盘写保护
    修改默认终端
    sudo apt-get update 无法获得锁
    logback多线程日志MDC
  • 原文地址:https://www.cnblogs.com/mochaMM/p/5114034.html
Copyright © 2011-2022 走看看