TypedArray a = obtainStyledAttributes(R.styleable.Gallery1);
int mGalleryItemBackground = a.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 0);
a.recycle();         
ImageView image = (ImageView)findViewById(R.id.imageview);
image.setBackgroundResource(mGalleryItemBackground);
         
<resources> 
    
    <!-- These are the attributes that we want to retrieve from the theme
         in view/Gallery1.java -->
    <declare-styleable name="Gallery1">
        <attr name="android:galleryItemBackground" />
    </declare-styleable>    
</resources>

相关文章:

  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2021-10-29
  • 2022-12-23
  • 2022-12-23
  • 2021-11-25
  • 2022-12-23
猜你喜欢
  • 2021-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-08-16
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
相关资源
相似解决方案