应用样式在Android图库项目 [英] Applying a style to items in Android Gallery
问题描述
时的任何方式应用样式资源自定义项边框的画廊类与Android?
Is their any way to apply a style resource to customize the Item Border in the Gallery Class with Android?
我试图隐藏或更改默认的灰色边框的颜色,而是以对事物的外表,这是不可能的?
I'm trying to hide or change the color of the default Grey border but by the looks of things this isn't possible?
任何帮助或提示您可以提供将是太棒了。
Any help or tips you can provide would be fantastic.
鸭preciated,
Appreciated,
汤姆
推荐答案
在 HelloGallery 样品他们的状态如何通过使用 attrs.xml
文件中添加默认的灰色边框在步骤5中。如果你不希望边框你可以简单跳过此步骤。
In the HelloGallery sample they state how to add the default gray border in step 5 by using an attrs.xml
file. If you don't want the border you can simple skip this step.
在创建一个ImageAdapter下一步骤中,在构造它们适用边界到的所有项目。如果你改变了构造以下code的边界应该走了,你应该只图像的一排左起:
In the next step an ImageAdapter is created, in the constructor they apply the border to all items. If you change the constructor to the following code the border should be gone and you should only have a row of your images left:
public ImageAdapter(Context c) {
mContext = c;
TypedArray a = obtainStyledAttributes(R.styleable.HelloGallery);
a.recycle();
}
此外,在 getView
方法有一个行 i.setBackgroundResource(mGalleryItemBackground);
可以在被删除这种情况下。
Also, in the getView
method there's a line i.setBackgroundResource(mGalleryItemBackground);
which can be removed in this case.
希望这可以帮助您在正确的方向一点点。
Hope this helps you a little bit in the right direction.
这篇关于应用样式在Android图库项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!