首页 > 其他 > 详细

关于R.styleable的问题

时间:2016-01-08 18:26:12      阅读:188      评论:0      收藏:0      [点我收藏+]

原文: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

res\values 

 

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <declare-styleable name="Gallery1"> 
        <attr name="android:galleryItemBackground" /> 
    </declare-styleable> 
</resources>

关于R.styleable的问题

原文:http://www.cnblogs.com/mochaMM/p/5114034.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!