마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

액션바 중앙정렬후 버튼을 추가시 문제

0 추천
<?xml version="1.0" encoding="utf-8"?>

<android.support.v7.widget.Toolbar
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    xmlns:tools="http://schemas.android.com/tools"
    android:background="#01C4C0"
    android:minHeight="?attr/actionBarSize"
    app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello"
        android:textColor="#FFFFFF"
        android:layout_gravity="center"
        android:id="@+id/toolbar_title"
        android:textSize="30sp"
        />
    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button"
        tools:layout_editor_absoluteX="29dp"
        tools:layout_editor_absoluteY="52dp" />

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

액션바 중앙정렬후 버튼을 추가시 버튼이 
액션바안에서 나가질못하네요ㅠㅠ 레이아웃문제인거같은데 어떻게 수정하죠?
액션바 중앙정렬후 버튼을 추가시 문제 님이 2018년 5월 15일 질문

1개의 답변

0 추천
Toolbar 안에 RelativeLayout 써서 해보심이 근데 그 방법을 사용해봤더니 Toolbar가 가지고 있는 StratPadding 때문에 TextView가 정확히 Center가 안됬던 기억이 나네요.

Toolbar를 꼭 사용해야할 이유가 있는게 아니라면 그냥 RelativeLayout 쓰시는게 어떨까요
익명사용자 님이 2018년 5월 15일 답변
...