Hello,
I have an issue when changing the text of a TextView in the main layout while my right-sided layout is visible. When I change the text, the right-sided layout is immediately hidden instead of remaining visible.
I've made this simple application to illustrate my problem. The number in the TextView is incremented every 3 seconds. So if you drag the right-sided layout, at the next incrementation, the layout will "refresh/reset" himself and i don't want that.
PS: When I set layout_width="match_parent" of the TextView, the problem doesn't happen.
public class Value {
private int value = 0;
private final TextView view;
private final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
value++;
view.setText(value+"");
}
};
public Value(TextView v) {
view = v;
incrementThread();
}
public void incrementThread() {
new Thread(new Runnable() {
@Override
public void run() {
while (true)
try {
handler.sendEmptyMessage(0);
Thread.sleep(2000);
} catch (InterruptedException ignored) {
}
}
}).start();
}
}
Hello, I have an issue when changing the text of a TextView in the main layout while my right-sided layout is visible. When I change the text, the right-sided layout is immediately hidden instead of remaining visible.
I've made this simple application to illustrate my problem. The number in the TextView is incremented every 3 seconds. So if you drag the right-sided layout, at the next incrementation, the layout will "refresh/reset" himself and i don't want that.
PS: When I set layout_width="match_parent" of the TextView, the problem doesn't happen.
Sources: MainActivity.java
Value.java
item_layout.xml