1
アンドロイドには小さな問題があります。特にタブ付きのアクティビティタブには問題があります。 アクションバーを上に動かすと、上下に動きます。他のアクティビティと同様に、このアクションバーを固定する必要があります。アンドロイドスタジオでのタブ付きアクティビティでアクションバーを固定する方法
これは私のコードです:
<?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/main_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context="com.example.herosaif.jadapp.Main2Activity">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/appbar_padding_top"
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:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="@style/AppTheme.PopupOverlay">
</android.support.v7.widget.Toolbar>
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_margin"
app:srcCompat="@android:drawable/ic_dialog_email" />
</android.support.design.widget.CoordinatorLayout>
おかげで仲間を私は別の質問を持っている:)、あなたが私の一日保存されていますどのように私はバーに新しいセクションを追加することができますか?タブ付きアクティビティデフォルトのバー番号は3つのセクションのみです。どのように4つのセクションを追加できますか? –
@HeroGuevaraあなたの活動の中に** "SectionsPagerAdapter" **というクラスがあります。このクラスには、** "getCount()" **というメソッドがあります。そこに必要なタブの量を返す必要があります。 – Steve2955
私はあなたの人を尊敬します、ありがとう、面白い質問私は10からあなたに尋ねることができますか?英語Langugeで何人いるの? –