0

我有三个活动,在我的第一个活动中,我有 2 个图像视图,通过单击每个图像,它会导航到下一个活动。这三个活动都包含图像视图。现在我的问题是当导航到点击下一个活动时,默认图像被突出显示,而不是我想突出显示我选择的特定图像。帮助我实现这一点。

4

2 回答 2

0

最后我找到了答案。这很简单,我们需要将请求焦点设置在特定图像上

img1.requestFocus();

接近特定的onclick。希望这可以帮助某人:-)

于 2013-11-07T09:38:50.737 回答
0

尝试将 setColorFilter 设置为您的视图。您可以突出显示您的特定视图。

PorterDuffColorFilter setNewFilter = 
new PorterDuffColorFilter(Color.GREEN, PorterDuff.Mode.SRC_ATOP);

ImageView imgSelected = (ImageView)findViewById(R.id.myImage);
Drawable d = imgSelected.getBackground();

d.setColorFilter(setNewFilter)

// Remove the filter by setting it as null.

d.setColorFilter(null);
于 2013-11-05T11:22:59.417 回答