[英]Keep Fragments Synconized - Fragment Android
I have an Android App using Fragments to create a sliding view. 我有一个使用Fragments创建滑动视图的Android应用。 I have 5 "Buttons" represented by FrameLayouts with content in them in Fragment A and Fragment B.
我有5个由FrameLayouts表示的“按钮”,其中的内容在片段A和片段B中。
When clicking a Layout it turn green for a few seconds, and the others don't in that space of time: 单击布局时,它会变为绿色几秒钟,而其他时间不在此时间范围内:
c05.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (Storage.isWaiting)
return;
Storage.isWaiting = true;
Toast.makeText(getActivity().getApplicationContext(), "Text abc 123", Toast.LENGTH_LONG).show();
c05.setBackgroundColor(Color.parseColor("#ff408c3a"));
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
c05.setBackgroundColor(Color.parseColor("#393939"));
Storage.isWaiting = false;
}
}, 3000);
}
});
I now need the to fragments to "syncronize" in a way that when i press button c01 in Fragment A c01 in Fragment B becomes green as well. 我现在需要to片段以“同步”的方式,当我按下片段A中的按钮c01时,片段B中的c01也变为绿色。
Do you have any Ideas how to do that? 您有任何想法怎么做?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.