두 가지 활동이 있습니다. 첫 번째는 간단한 로그인 페이지입니다. 필요없는 액션 바를 비활성화했으며, 두 번째 활동은 사용자 피드 섹션입니다. 텍스트 또는 검색 옵션 및 앱 서랍이있는 작업 표시 줄을 추가하려고합니다. 두 번째 활동에는 작업 표시 줄을 추가하지만 처음에는 활동 표시 줄을 추가하지 않으려면 어떻게합니까?두 번째 활동에 작업 표시 줄을 추가하는 방법 첫 번째 활동에 추가하지 않는 방법
-1
A
답변
0
기본적으로 작업 표시 줄이 없도록 app 테마를 만들어야합니다.
android:theme="@style/AppTheme"
그리고 당신이 어떤 활동에 작업 표시 줄이 필요하면 당신의 활동 레이아웃 파일에 추가하십시오 :
<?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:id="@+id/coordinator_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="owo.owocar.driver.rides_history_entity.ui.HistorySingleActivity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:background="@drawable/gradient"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:background="@drawable/gradient"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/content_history_single" />
</android.support.design.widget.CoordinatorLayout>
이 줄을 추가
<application>
태그에서의 AndroidManifest.xml 파일에서
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorPrimary</item>
</style>
,
0
두 번째 활동에 대해 다른 테마를 정의 할 수 있습니다.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
...
</style>
<style name="LoginTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
</style>
0
AppTheme에 NoActionBar 스타일을 사용합니다.
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
</style>
그런 다음 당신은 작업 표시 줄을 원하는 활동의 레이아웃에, 당신은 그것을 포함 할 수
<?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"
android:fitsSystemWindows="true"
tools:context="com.xxx.xxx.Activity">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
<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" />
</android.support.design.widget.AppBarLayout>
<include layout="@layout/fragment" />
</android.support.design.widget.CoordinatorLayout>
이 어떤 버튼/텍스트/메뉴없이, 활동의 상단에 막대를 생성합니다. Activity.java 안에 툴바를 만드십시오.
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
희망이 있습니다.
관련 문제
- 1. 두 번째 활동에 작업 표시 줄 항목을 추가하는 방법
- 2. 첫 번째 활동에 두 번째 활동 의도를 수신하는 방법
- 3. 두 번째 활동에 텍스트를 표시하는 방법
- 4. Android 첫 번째 활동에 mp3를로드하고 더 이상 활동에 액세스하지 않음
- 5. 첫 번째 Android 활동에 대한 도움말
- 6. 두 번째 Android 활동에 문자열이 전달되지 않습니다.
- 7. ListView 항목을 두 번째 ListView 활동에 복제하는 방법
- 8. 첫 번째 항목을 클릭하여 두 번째 탭 표시 줄을 슬라이드하십시오.
- 9. 활동에 여러 레이아웃을 추가하는 방법
- 10. Android Espresso : 두 번째 활동에 대한 테스트 사례 실행
- 11. MainActivity에 두 번째 단추 코드를 추가하는 방법
- 12. 첫 번째 활동에 대한 데이터를 얻고 두 번째 활동에서 그 데이터를 사용하는 방법은 무엇입니까?
- 13. 모든 활동에 대해 작업 표시 줄을 유지하고 싶습니다.
- 14. 최근 활동을 다른 활동에 추가하는 방법
- 15. 두 번째 UIPageViewController를 추가하는 방법
- 16. 동일한 활동에 두 개의 actionBar
- 17. 주요 활동에서 두 번째 활동 표시 줄까지
- 18. 파일의 첫 번째 n 줄을 결합하는 방법
- 19. Scala에서 파일의 첫 번째 줄을 얻는 방법
- 20. 기본 작업 표시 줄을 추가하는 방법
- 21. 첫 번째 이미지가 시작되는 동안 상태 표시 줄을 제거하는 방법
- 22. CSV 파일의 첫 번째 줄을 건너 뛰고 두 번째 줄을 머리글로 만드는 방법
- 23. Android : 의도로 시작하는 두 번째 활동에 admod를 추가하려고합니다.
- 24. 기본값 이외의 활동에 테마를 추가하는 방법
- 25. Android - 활동에 동적 이미지를 추가하는 방법
- 26. 첫 번째 활동에서 네 번째 활동까지의 정보
- 27. Python과 pyPDF로 첫 번째 두 줄을 추출합니다.
- 28. 두 번째 줄을 첫 번째 줄에 추가/병합하려면 어떻게합니까?
- 29. 활동에 대한보기를 생성하는 방법
- 30. KeyChain.choosePrivateKeyAlias 활동에 액세스하는 방법?