0
我寫了一個代碼,以擴大選定的圖像在我的畫廊,我不知道爲什麼每次我滾動,畫廊失去焦點,這裏是我的代碼。畫廊失去焦點
gallery.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent, View v,
int position, long id) {
if (lasview != null)
lasview
.setLayoutParams(new Gallery.LayoutParams(130, 195));
lasview = v;
v.setLayoutParams(new Gallery.LayoutParams(170, 230));
}
public void onNothingSelected(AdapterView<?> parent) {
// System.out.println("NOTHING SELECTED");
}
});
getView本身導致失去焦點的方法,因爲它包含setLayoutParams,請問有沒有解決方法?因爲這對我很重要? – Vervatovskis
我猜你也可以在完成更改後將'requestFocus()'添加到您想要關注的圖庫/視圖以強制焦點。 – Jave