我有一个 TextView 组件。我想在每个 Activity 中显示 TextView,并且不想在每个布局中编写此组件。
public class Test extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alarm);
LayoutInflater flater = LayoutInflater.from(this);
View view = flater.inflate(R.layout.toolbar_clearbalk, null);
TextView text=(TextView)view.findViewById(R.id.now_time);
}
now_time 是我找到的组件。我该怎么做才能让 TextView 在当前界面中显示?