LinearLayout: fix focus after removing child

This commit is contained in:
Alexandre Bury 2018-06-27 13:32:39 -07:00
parent a47537ec2c
commit 4c70b79663

View File

@ -181,6 +181,10 @@ impl LinearLayout {
pub fn remove_child(&mut self, i: usize) -> Option<Box<View>> { pub fn remove_child(&mut self, i: usize) -> Option<Box<View>> {
if i < self.children.len() { if i < self.children.len() {
self.invalidate(); self.invalidate();
if self.focus > i {
self.focus -= 1;
}
Some(self.children.remove(i).view) Some(self.children.remove(i).view)
} else { } else {
None None