Я пытаюсь реализовать тулбара, похожий на тот, видели здесь: Android Расширенная панель с EditTexts
Я также хочу, чтобы иметь заголовок в верхней части панели инструментов, которые я, кажется, не быть в состоянии сделать мой текущий макет.
Моя текущая раскладка панель инструментов:
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:float="http://schemas.android.com/apk/res-auto"
android:id="@+id/new_monitor_toolbar"
android:minHeight="?android:attr/actionBarSize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:orientation="vertical">
<!-- Toolbar space -->
<Space
android:layout_width="match_parent"
android:layout_height="56dp"/>
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
style="@style/EditTextHeadline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:paddingTop="16dp"
android:hint="Name"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditText>
<!-- First divider space -->
<Space
android:layout_width="match_parent"
android:layout_height="8dp"/>
<com.wrapp.floatlabelededittext.FloatLabeledEditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
float:fletTextAppearance="@style/floatlabelededittext">
<EditText
style="@style/EditTextSubhead"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="12dp"
android:paddingTop="12dp"
android:hint="URL"/>
</com.wrapp.floatlabelededittext.FloatLabeledEditText>
<!-- Second divider space -->
<Space
android:layout_width="match_parent"
android:layout_height="16dp"/>
</LinearLayout>
Моя активность:
Toolbar toolbar = (Toolbar) findViewById(R.id.new_monitor_toolbar);
if (toolbar != null) {
setSupportActionBar(toolbar);
getSupportActionBar().setTitle("New Page Monitor");
Toast.makeText(this, "Should have title", Toast.LENGTH_SHORT).show();
}
Я также не уверен, как получить стрелку назад, чтобы показать правильно. Любая помощь будет замечательной! Благодарю.
Панель I Указан в расположение моей acttivty. Предложенный выше макет - это просто макет панели инструментов, который включен в основное действие. – Nath5
Можете ли вы поместить оператор журнала в свой оператор if, чтобы убедиться, что панель инструментов не равна нулю? –