android MaterialBetterSpinner提示颜色不会改变

时间:2017-02-21 09:15:27

标签: android android-studio

我正在尝试更改材质设计的颜色更好的微调器,但没有任何作用,我试图将其更改为颜色定义的颜色或通过定义样式并在主题中使用它:

android:theme="@style/TextLabel"

但没有任何帮助,有人可以帮忙吗?

<com.weiwangcn.betterspinner.library.material.MaterialBetterSpinner
    android:id="@+id/some"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:hint="Range"
    android:textColorHint="@color/colorHint"
    app:met_floatingLabel="normal" />

3 个答案:

答案 0 :(得分:5)

使用此:

app:met_textColorHint="@color/colorHint"

编辑: 您可以根据您的要求使用以下任何属性:

  <attr name="met_baseColor" format="color" />
    <attr name="met_primaryColor" format="color" />
    <attr name="met_floatingLabel">
        <enum name="none" value="0" />
        <enum name="normal" value="1" />
        <enum name="highlight" value="2" />
    </attr>
    <attr name="met_errorColor" format="color" />
    <attr name="met_minCharacters" format="integer" />
    <attr name="met_maxCharacters" format="integer" />
    <attr name="met_singleLineEllipsis" format="boolean" />
    <attr name="met_minBottomTextLines" format="integer" />
    <attr name="met_helperText" format="string" />
    <attr name="met_helperTextColor" format="color" />
    <attr name="met_accentTypeface" format="string" />
    <attr name="met_typeface" format="string" />
    <attr name="met_floatingLabelText" format="string" />
    <attr name="met_floatingLabelPadding" format="dimension" />
    <attr name="met_hideUnderline" format="boolean" />
    <attr name="met_underlineColor" format="color" />
    <attr name="met_autoValidate" format="boolean" />
    <attr name="met_iconLeft" format="reference" />
    <attr name="met_iconRight" format="reference" />
    <attr name="met_iconPadding" format="dimension" />
    <attr name="met_clearButton" format="boolean" />
    <attr name="met_floatingLabelTextSize" format="dimension" />
    <attr name="met_floatingLabelTextColor" format="color" />
    <attr name="met_bottomTextSize" format="dimension" />
    <attr name="met_floatingLabelAlwaysShown" format="boolean" />
    <attr name="met_helperTextAlwaysShown" format="boolean" />
    <attr name="met_floatingLabelAnimating" format="boolean" />
    <attr name="met_textColor" format="color" />
    <attr name="met_textColorHint" format="color" />
我使用的是:

   app:met_baseColor="@color/black"
   app:met_floatingLabel="highlight"
   app:met_primaryColor="@color/colorPrimary"
   app:met_floatingLabelTextColor="@color/black"
   app:met_textColor="@color/black"
   app:met_textColorHint="@color/black"
   app:met_underlineColor="@color/black"

答案 1 :(得分:0)

它对我有用。

 <com.weiwangcn.betterspinner.library.BetterSpinner
            android:id="@+id/classSpinner"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="@drawable/edittext_bg"
            android:hint="Select Class"
            android:textColorHint="@color/colorPrimary"
            android:paddingLeft="20dp"
            android:paddingRight="20dp" />

答案 2 :(得分:0)

使用它可能对您有所帮助

编译'com.weiwangcn.betterspinner:library-material:1.1.0'

public class CustomMaterialSpinner extends MaterialBetterSpinner {

public CustomMaterialSpinner(Context context) {
    super(context);
}

public CustomMaterialSpinner(Context arg0, AttributeSet arg1) {
    super(arg0, arg1);
}

public CustomMaterialSpinner(Context arg0, AttributeSet arg1, int arg2) {
    super(arg0, arg1, arg2);
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    if (isEnabled())
        return super.onTouchEvent(event);

    else return false;
}

/*@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    this.selected = area[position];
}*/

}