Sve*_*ver 6 android gallery imageview
我有画廊小部件,当你滚动它时,当前选择的图像有边框 - 只是简单的选择器,像这样
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="@drawable/thumbnail_frame" />
<item
android:drawable="@android:color/transparent" />
Run Code Online (Sandbox Code Playgroud)
并在画廊适配器的getView中附加这样的
image.setBackgroundDrawable(getResources().getDrawable(R.drawable.xxx));
Run Code Online (Sandbox Code Playgroud)
问题是,当我使用setSelection()更改图库选择时,所选项目没有边框.但是,当我只是用手指边框滚动选定的项目工作正常.我认为,setSelection()不会触发setSelected()或类似的东西.
我想,解决方案是调用setSelected()和setSelection(),但是如何为当前选择的ImageView调用它?或者还有其他方法吗?
| 归档时间: |
|
| 查看次数: |
1267 次 |
| 最近记录: |