gpt4 book ai didi

android - 未能找到样式 vpiCirclePageIndicatorStyle

转载 作者:IT老高 更新时间:2023-10-28 23:11:01 26 4
gpt4 key购买 nike

我想在我的项目中使用 viewpageindicator,但无法导入它。我的 XML 中有错误。

Missing styles. Is the correct theme chosen for this layout?
Use the Theme combo box above the layout to choose a different layout, or fix the theme style references.

Failed to find style 'vpiCirclePageIndicatorStyle' in current theme

我的 XML 文件:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >


<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />

<com.viewpagerindicator.CirclePageIndicator
android:id="@+id/indicator"
android:layout_width="248dp"
android:layout_height="30dp"
android:layout_alignParentBottom="true"
android:layout_below="@id/pager"
android:layout_centerHorizontal="true"
android:layout_marginBottom="30dp"
android:padding="3dip" />


</RelativeLayout>

我更新的 res/values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">

<style name="hololightnoactionbar" parent="android:Theme.Holo.Light">
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>

<style name="dividerstyle" parent="@android:style/Widget.ListView">
<item name="android:cacheColorHint">@android:color/transparent</item>
<item name="android:divider">@drawable/list_divider</item>
<item name="android:dividerHeight">1px</item>
</style>

<style name="roundedwhitebox">
<item name="android:background">@drawable/roundedwhitebox</item>
</style>

<style name="roundedlightgraybox">
<item name="android:background">@drawable/roundedlightgraybox</item>
</style>

<style name="rotatingProgressCircle">
<item name="android:indeterminateDrawable">@drawable/circleindeterminate</item>
</style>

<style name="StyledIndicators" parent="@android:style/Theme.Light">
<item name="vpiCirclePageIndicatorStyle">@style/CustomCirclePageIndicator</item>
<item name="vpiLinePageIndicatorStyle">@style/CustomLinePageIndicator</item>
<item name="vpiTitlePageIndicatorStyle">@style/CustomTitlePageIndicator</item>
<item name="vpiTabPageIndicatorStyle">@style/CustomTabPageIndicator</item>
<item name="vpiUnderlinePageIndicatorStyle">@style/CustomUnderlinePageIndicator</item>
</style>

<style name="CustomTitlePageIndicator">
<item name="android:background">#18FF0000</item>
<item name="footerColor">#FFAA2222</item>
<item name="footerLineHeight">1dp</item>
<item name="footerIndicatorHeight">3dp</item>
<item name="footerIndicatorStyle">underline</item>
<item name="android:textColor">#AA000000</item>
<item name="selectedColor">#FF000000</item>
<item name="selectedBold">true</item>
</style>

<style name="CustomLinePageIndicator">
<item name="strokeWidth">4dp</item>
<item name="lineWidth">30dp</item>
<item name="unselectedColor">#FF888888</item>
<item name="selectedColor">#FF880000</item>
</style>

<style name="CustomCirclePageIndicator">
<item name="fillColor">#FF888888</item>
<item name="strokeColor">#FF000000</item>
<item name="strokeWidth">2dp</item>
<item name="radius">10dp</item>
<item name="centered">true</item>
</style>

<style name="CustomTabPageIndicator" parent="Widget.TabPageIndicator">
<item name="android:textAppearance">@style/CustomTabPageIndicator.Text</item>
<item name="android:textColor">#FF555555</item>
<item name="android:textSize">16sp</item>
<item name="android:divider">@drawable/custom_tab_indicator_divider</item>
<item name="android:dividerPadding">10dp</item>
<item name="android:showDividers">middle</item>
<item name="android:paddingLeft">8dp</item>
<item name="android:paddingRight">8dp</item>
<item name="android:fadingEdge">horizontal</item>
<item name="android:fadingEdgeLength">8dp</item>
</style>

<style name="CustomTabPageIndicator.Text" parent="android:TextAppearance.Medium">
<item name="android:typeface">monospace</item>
</style>

<style name="CustomUnderlinePageIndicator">
<item name="selectedColor">#FFCC0000</item>
<item name="android:background">#FFCCCCCC</item>
<item name="fadeLength">1000</item>
<item name="fadeDelay">1000</item>
</style>

</resources>

我的项目结构在这里,其中vpilibrary是导入的viewpageindicator库

enter image description here

它有什么问题?如果您需要更多文件进行调试,请告诉我。谢谢

ps:我的minsdkversion和targetsdkversion都是16

最佳答案

问题: Problem

解决方案:

  1. res/layout/values/styles.xml 中添加自定义样式

您可以找到一些示例 here .

<style name="StyledIndicators" parent="@android:style/Theme.Light">
<item name="vpiCirclePageIndicatorStyle">@style/CustomCirclePageIndicator</item>
</style>

<style name="CustomCirclePageIndicator">
<item name="fillColor">#000000</item>
<item name="strokeColor">#000000</item>
<item name="strokeWidth">1dp</item>
<item name="radius">6dp</item>
<item name="centered">true</item>
</style>
  1. 在您的 Activity 中添加新样式作为主题,“StyledIndicators”:

    <activity
    android:name=".YourActivity"
    android:theme="@style/StyledIndicators" >
    </activity>
  2. 之后只需要将主题改为项目自带的,选择Manifest Themes - StyledIndicators即可。

enter image description here

关于android - 未能找到样式 vpiCirclePageIndicatorStyle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20861659/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com