Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个在 ListView 中显示所有联系人姓名的应用程序。单击时,该应用程序会在另一个活动中显示该联系人的所有详细信息。我想在另一个活动的操作栏上显示联系人姓名作为标题,以便用户可以在他单击的操作栏上看到联系人姓名。
在创建内部的其他活动中,您可以执行以下操作:
String name; // Get the name from the exttra of the intent or howsoever you are getting the name ActionBar ab = getActionBar(); ab.setTitle(name);
您可以替换name为您可以传递的联系人姓名,如extras或intent通过其他方式。
name
extras
intent