当我将所有东西都改为白色时,我的微调器仍然是黑色的,为什么>

问题描述:

就像我说的。我不知道如何将我的spinner中的所有内容都设置为白色。 问题是这样的图像 ​​当我将所有东西都改为白色时,我的微调器仍然是黑色的,为什么>

就像你看,我有白色和黑色总是与黑色的背景这个按钮是不好可见英寸

下面是一些代码:

<Spinner 
     android:id="@+id/spinner_money" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_marginTop="10dp" 
     android:text="50$" 
     android:textColor="@color/white" 
     android:textSize="20sp" /> 

什么是错的家伙?

在这里,我confgure微调

private void configureSpinnerDataAndLogic() { 
    String[] arraySpinner = new String[]{ 
      "50", "100", "150", "200", "250", "300", "400", "500"}; 

    ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), 
      android.R.layout.simple_list_item_1, arraySpinner); 
    spinnerData.setAdapter(adapter); 
    spinnerData.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { 
     @Override 
     public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { 
      ((TextView) parent.getChildAt(0)).setTextColor(Color.WHITE); 
      String text = spinnerData.getSelectedItem().toString(); 
      int temp = Integer.parseInt(text); 
      text_profit.setText((temp * 2) + " $ " + "100%"); 
     } 

     @Override 
     public void onNothingSelected(AdapterView<?> parent) { 
     } 
    }); 
} 

编辑:

<?xml version="1.0" encoding="utf-8"?> 
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> 
    <item 
     android:width="20dp" 
     android:gravity="right" 
     android:layout_centerVertical="true" 
     android:height="20dp"> 
     <rotate 
      android:fromDegrees="45" 
      android:pivotX="135%" 
      android:pivotY="15%" 
      android:toDegrees="45"> 
      <shape android:shape="rectangle"> 
       <solid 
        android:color="@color/white" /> 
      </shape> 
     </rotate> 
    </item> 
</layer-list> 

enter image description here

+0

你必须设置微调 – Ibrahim

+0

与此微调yahahha这么多工作一个自定义适配器:d – Genehme

+0

我修改了主哨 – Genehme

您可以在XML中的纺织背景色是这样的:

android:background="@color/white" 

,如果你正在使用下拉那么在这样的XML:

android:popupBackground="@color/your_color_for_items" 

在情况下,如果你正在使用自定义适配器,请检查该thread

+0

没有帮助:((( – Genehme

+0

@Genehme:我已经更新了我的答案,您需要对自定义适配器进行更改,请检查它。 – Rohit