2016-11-18 6 views
0
<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context=".Activity_Compose"> 

<android.support.design.widget.AppBarLayout 
    android:id="@+id/appbar" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:theme="@style/AppTheme.AppBarOverlay" 
    app:elevation="0dp"> 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:layout_gravity="right" 
     android:background="?attr/colorPrimary" 
     android:elevation="2dp" 
     android:gravity="right" 
     tools:targetApi="lollipop"> 

     <ImageView 
      android:id="@+id/imgComposeCancel" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:padding="@dimen/min_padding" 
      android:contentDescription="@string/image" 
      app:srcCompat="@drawable/exit" /> 

     <com.example.CustomTextView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Compose" 
      android:textColor="@color/white" 
      android:textSize="@dimen/min_textsize" 
      app:font="@string/montserrat_regular" /> 

     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:gravity="center|right"> 

      <ImageView 
       android:id="@+id/imgComposeAttach" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:padding="@dimen/min_padding" 
       android:contentDescription="@string/image" 
       app:srcCompat="@drawable/mail_attach" /> 

      <ImageView 
       android:id="@+id/imgComposeSend" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:padding="@dimen/min_padding" 
       android:contentDescription="@string/image" 
       app:srcCompat="@drawable/mail_send" /> 

     </LinearLayout> 

     </android.support.v7.widget.Toolbar> 

    </android.support.design.widget.AppBarLayout> 

     <include 
     android:id="@+id/layout_dash_child" 
     layout="@layout/act_compose_view" /> 


    </android.support.design.widget.CoordinatorLayout> 

включен макет здесьандроида Панель appbarlayout

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/activity_compose"> 




    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:gravity="center|start" 
     android:orientation="horizontal" 
     android:padding="@dimen/most_min_padding" 

     android:weightSum="2"> 


     <com.example.CustomTextView 
      android:id="@+id/txtComposeTo" 
      style="@style/label_text_secondary_compose_mail" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.85" 
      android:gravity="start" 
      android:text="@string/to" 
      app:font="@string/montserrat_light" /> 

     <com.doodle.android.chips.ChipsView 
      android:id="@+id/chipsView" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.25" 
      android:nextFocusDown="@+id/cstmBtnAddStaff" 
      app:cv_max_height="130dp" 
      app:cv_vertical_spacing="2dp" /> 

     <com.example.CustomButton 
      android:id="@+id/cstmBtnAddStaff" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_weight="0.9" 
      android:background="@color/blue" 
      android:nextFocusDown="@+id/cstmBtnAddStaff" 
      android:text="+" 
      android:textColor="@android:color/white" 
      android:textSize="20sp" 
      app:font="@string/montserrat_regular" /> 


    </LinearLayout> 

    <View 
     android:layout_width="match_parent" 
     android:layout_height="0.1dp" 
     android:background="@color/not_black" /> 


    <com.example.CustomEditText 
     android:id="@+id/txtComposeSubjectContent" 
     style="@style/label_text_secondary_compose_mail" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/white" 
     android:hint="Subject" 
     android:maxLines="1" 
     android:nextFocusDown="@+id/editor" 
     android:padding="@dimen/most_min_padding" 

     android:singleLine="true" 
     android:textCursorDrawable="@drawable/cursor_color" 
     app:font="@string/montserrat_light" 
     app:met_hideUnderline="true" /> 

</LinearLayout> 

why this type of behaviour happening

Моя панель пошел позади, чтобы в строке состояния. Мне нужно избавиться от этой проблемы. Помощи будут upvoted.i добавил студентов, и после щелчка на txtComposeSubjectContent edittext, все макет, включая панель инструментов, попали под строку состояния. что здесь есть. Я не добавил никаких стилей здесь.

+0

Почему вы добавляете теги как инструменты: targetApi = "lollipop" в панели инструментов –

+0

для отметки = "2dp" – Sev

+0

попробуйте удалить этот тег –

ответ

0

Я думаю, что ваша проблема зависит от высоты, предусмотренной для AppBarLayout и панели инструментов, она выбирает высоту из стилей, попробуйте использовать wrap_content, если вы не возражаете против действительно большой панели инструментов.

Другой подход может заключаться в том, чтобы переопределить стили для AppBarLayout и/или панели инструментов и поиграть со стандартным отступом/полями.

Для примера:

<style name="MyCustomTabLayout" parent="Widget.Design.TabLayout"> 
    <item name="tabTextAppearance">@style/MyCustomTextAppearance</item> 
    <item name="padding">8dp</item> 
</style> 

<style name="MyCustomTextAppearance" parent="TextAppearance.Design.Tab"> 
    <item name="textAllCaps">false</item> 
    <item name="android:textSize">@dimen/tab_text_size</item> 
    <item name="android:textColor">@color/red</item> 
</style> 

Как вы можете видеть здесь им изменения стандартного отступы для макета AppBar и предоставление нестандартного размера и цвета для текста некоторых вкладок, которые я получил внутри AppBar.

Если это не работает, позвольте коду, как вы его получили, и попробуйте на разных устройствах, если ваша проблема не исчезнет, ​​это происходит потому, что вы используете пользовательский вид внутри панели инструментов, а методы onDraw() сталкиваются по-видимому из-за неправильный метод onMeasure(), если вы действительно хотите продолжить этот подход, у вас будет много проблем. Я думаю, что вы делаете это, потому что вам нужно поведение координатораLayout, если вы не возражаете, объясните, чего вы хотите достичь, и мы могли бы предложить разные подходы.

+0

Я думаю, что это не проблема высоты, это похоже на прокрутку. макет поместился в строку состояния. – Sev

 Смежные вопросы

  • Нет связанных вопросов^_^