问题是我正在将这些文字视图从另一个布局扩展到工具栏中我将在下面提供他们的代码。我已经尝试了所有可能做的事情。它甚至没有去编程
这是我在扩充该布局并设置自定义视图的代码
private DatabaseReference mRootRef;
private FirebaseAuth mAuth;
private String mChatUser;
private String mCurrentUserId;
private Toolbar mChatToolbar;
private TextView mTitleView;
private TextView mLastSeenView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chat);
mChatToolbar = (Toolbar) findViewById(R.id.chat_app_bar);
setSupportActionBar(mChatToolbar);
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowCustomEnabled(true);
mRootRef = FirebaseDatabase.getInstance().getReference();
mAuth = FirebaseAuth.getInstance();
mCurrentUserId = mAuth.getCurrentUser().getUid();
mChatUser = getIntent().getStringExtra("user_id");
String userName = getIntent().getStringExtra("user_name");
LayoutInflater inflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View action_bar_view = inflater.inflate(R.layout.chat_custom_bar, null);
actionBar.setCustomView(action_bar_view);
// ---- Custom Action bar Items ----
mTitleView = (TextView) findViewById(R.id.custom_bar_title);
mLastSeenView = (TextView) findViewById(R.id.custom_bar_seen);
答案 0 :(得分:2)
试试这个
getSupportActionBar().setDisplayShowTitleEnabled(false);
答案 1 :(得分:0)
在舱单声明中
@Mock
private ITemplateEngine emailTemplateEngine;
@Before
public void setup(){
@when(emailTemplateEngine.process(eq(TEMPLATE_USER_CREATION), any(Context.class))).thenReturn(userCreationHtml);
.
.
.
}
label标签是工具栏标题。您可以将其从清单或<activity
android:name="com.example.nikhil_pc.fritz.MainActivity"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="portrait"
android:theme="@style/AppTheme.NoActionBar">
方法调用onCreate