Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android Studio选项卡查看灰色主题颜色_Java_Xml_Android Studio - Fatal编程技术网

Java Android Studio选项卡查看灰色主题颜色

Java Android Studio选项卡查看灰色主题颜色,java,xml,android-studio,Java,Xml,Android Studio,所以我用片段创建了标签视图,一切都很顺利,除了整个布局颜色是深灰色(不知道为什么)和标签线颜色是粉红色(也不知道为什么) 看起来像这样 此外,正如您所看到的,iz在操作栏和选项卡栏之间有着奇怪的间距(也不知道为什么) 这是我的密码: Vjezbe.java package hr.app.liftme.liftmehr; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; imp

所以我用片段创建了标签视图,一切都很顺利,除了整个布局颜色是深灰色(不知道为什么)和标签线颜色是粉红色(也不知道为什么)

看起来像这样

此外,正如您所看到的,iz在操作栏和选项卡栏之间有着奇怪的间距(也不知道为什么)

这是我的密码:

Vjezbe.java

package hr.app.liftme.liftmehr;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

public class Vjezbe extends AppCompatActivity {
    Toolbar toolbar;
    TabLayout tabLayout;
    ViewPager viewPager;
    ViewPagerAdapter viewPagerAdapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_vjezbe);
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);

        toolbar = (Toolbar)findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        tabLayout = (TabLayout)findViewById(R.id.tabLayout);
        viewPager = (ViewPager)findViewById(R.id.viewPager);
        viewPagerAdapter = new ViewPagerAdapter(getSupportFragmentManager());
        viewPagerAdapter.addFragments(new HomeFragment(), "Prsa");
        viewPagerAdapter.addFragments(new TopFreeFragment(), "Leđa");
        viewPagerAdapter.addFragments(new TopPaidFragment(), "Ramena");

        viewPagerAdapter.addFragments(new TrapeziFragment(), "Trapezi");
        viewPager.setAdapter(viewPagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
    }

}
activity_vjezbe.xml

<?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="hr.app.liftme.liftmehr.Vjezbe">

    <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/content_vjezbe" />



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

styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

@颜色/原色
@颜色/原色暗
@颜色/颜色重音
假的
真的
所以,如果有人能带我走过我的错误,我会非常感激

谢谢大家!

此外,整个布局的颜色是深灰色(不知道为什么),标签行的颜色是粉红色(也不知道为什么)

尝试在
res/values/colors.xml
中更改主色和强调色,如:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color> <!-- Tab color -->
    <color name="colorPrimaryDark">#303F9F</color> <!-- Status bar color -->
    <color name="colorAccent">#FF4081</color> <!-- Tab indicator color -->
</resources>
在活动的
onCreate
中:

.
.
String[] titles = new String[] {"Prsa", "Leđa", "Ramena", "Trapezi"};
MyFragmentPagerAdapter myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), titles);
.
.
此外,整个布局的颜色是深灰色(不知道为什么),标签行的颜色是粉红色(也不知道为什么)

尝试在
res/values/colors.xml
中更改主色和强调色,如:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color> <!-- Tab color -->
    <color name="colorPrimaryDark">#303F9F</color> <!-- Status bar color -->
    <color name="colorAccent">#FF4081</color> <!-- Tab indicator color -->
</resources>
在活动的
onCreate
中:

.
.
String[] titles = new String[] {"Prsa", "Leđa", "Ramena", "Trapezi"};
MyFragmentPagerAdapter myFragmentPagerAdapter = new MyFragmentPagerAdapter(getSupportFragmentManager(), titles);
.
.