나는 활동 제목을 설정하는 두 가지 방법이 있다는 것을 알고 있습니다. 한 가지 방법은 android : label = "@ string/app_name"과 같은 android manifest에서 설정하는 것입니다. 두 번째는 프로그래밍 방식으로 setTitle ("Hello World!")과 같은 활동 클래스에서 설정됩니다. 두 방법 모두 왼쪽에 위치하지만 어떻게 센터에 배치 할 수 있습니까? 활동 태그 내부 매니페스트 파일에
은답변
시도가 경쟁 텍스트를 추가하여 사용자 지정 제목을 만들 수 활동에이
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Toolbar Title"
android:layout_gravity="center"
android:id="@+id/toolbar_title" />
</android.support.v7.widget.Toolbar>
전화 등의 도구 모음에서
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_top);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayShowTitleEnabled(false);
TextView mTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
mTitle.setText("any");
다음 기본 앱 이름을 제거하는 방법 actionBar .. –
getSupportActionBar(). setDisplayShowTitleEnabled (false); –
당신은 완벽한 아래에 Hitesh 방법 대답을 사용할 수 있습니다 –
사용 도구 모음
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/img_header">
<TextView
android:id="@+id/activity_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:text="TITLE"
android:layout_gravity="center"
android:textColor="@android:color/white"
android:textSize="@dimen/dim_20"
android:typeface="serif" />
</android.support.v7.widget.Toolbar>
세트 테마 NotitleBar
android:theme="@android:style/Theme.Translucent.NoTitleBar"
또는
setSupportActionBar(findViewById(R.id.toolbar));
다음 작업 모음에서 기본 앱 이름을 제거하는 방법 –
내 대답을 편집했습니다. 다시 확인하십시오. –
이 시도 W :
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="@style/AppTheme.PopupOverlay">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Android Toolbar"
android:textColor="@android:color/white"
android:textSize="18sp"
android:textStyle="bold"
android:layout_gravity="center"
android:id="@+id/toolbar_title" />
</android.support.v7.widget.Toolbar>
당신의 Activity
에서 :
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
TextView mTitle = (TextView) toolbar.findViewById(R.id.toolbar_title);
mTitle.setText("Your Title");
setSupportActionBar(toolbar);
getSupportActionBar().setTitle(""); // Hide default app name
- 1. 작업 표시 줄을 개선하는 방법
- 2. 작업 표시 줄을 만드는 방법
- 3. 센터 작업 표시 줄 제목
- 4. 작업 표시 줄을 VB
- 5. 오름차순으로 줄을 정렬하는 방법
- 6. 전체 화면이지만 작업 표시 줄을 표시하는 방법
- 7. 작업 표시 줄을 투명하게 만드는 방법
- 8. 모든 활동에서 작업 표시 줄을 고정시키는 방법?
- 9. 특정 조각에서 작업 표시 줄을 숨기는 방법
- 10. 파이 게임에서 작업 표시 줄을 숨기는 방법
- 11. '작업'이 '작업 중'진행률 표시 줄을 표시하는 방법
- 12. Windows 7에서 작업 표시 줄을 숨기는 방법?
- 13. 기본 작업 표시 줄을 추가하는 방법
- 14. 페이지 매김을 정렬하는 센터
- 15. 리눅스, 파일의 줄을 정렬하는 방법
- 16. BASH에서 파일 줄을 정렬하는 방법
- 17. 작업 표시 줄을 사용하여 작업 시작 방법 항목
- 18. 안드로이드의 진행 표시 줄을 작업 표시 줄에 표시하는 방법?
- 19. 분할 작업 표시 줄을 표시하는 동안 작업 표시 줄 숨기기
- 20. 평균 센터 센터 표시 자
- 21. 상태 표시 줄 내부에 진행 표시 줄을 정렬하는 방법은 무엇입니까?
- 22. 수를 기준으로 줄을 정렬하는 방법 UNIX?
- 23. 자동 숨기기 Windows 작업 표시 줄을 보여줍니다
- 24. 스 와이프보기에 작업 표시 줄을 추가하려면 어떻게해야하나요?
- 25. 작업 표시 줄을 사용하는 Android Ui
- 26. 페이지의 Windows 작업 표시 줄을 숨기려면
- 27. Android FragmentActivity가 작업 표시 줄을 표시하지 않습니다.
- 28. windows7에 텍스트 작업 표시 줄을 표시하려고합니다.
- 29. 전체 화면 WPF에서 작업 표시 줄을 숨기기
- 30. 레이아웃에서 작업 표시 줄을 구성하는 방법은 무엇입니까?
툴바를 사용하는 경우 텍스트 표제 어테 렐 런스 –
Google에서 검색하십시오. 지금까지 시도한 바가 있습니까 ?? –
가능한 [안드로이드 액션 바 제목 센터 정렬 방법?] (http://stackoverflow.com/questions/21770428/how-to-make-android-action-bar-title-center-aligned) 가능한 복제본 – Pehlaj