I am trying to display a spinner inside a pop up window. And I want a portion of the text of each drop down item to be green. More specifically, an option would look like : "Transaction Type: Pay Cash, Meet Up". And I want the words "Transaction Type" to be in green and the rest of the words to be in black. I tried the font color attribute, but that is not working.
Code for string-array xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="payment_list">
<item><font color="#00ff00">Transaction Type: </font>Pay Cash, Meet Up</item>
<item><font color="#00ff00">Transaction Type: </font>Credit Card, Meet Up</item>
<item><font color="#00ff00">Transaction Type: </font>Credit Card, Ship to Me</item>
</string-array>
Code for the pop up window:
final Button makeoffer = (Button) view.findViewById(R.id.make_offer);
makeoffer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
LayoutInflater layoutInflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View popupView = layoutInflater.inflate(R.layout.offer_popup, null);
final PopupWindow popupWindow = new PopupWindow(popupView,LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
EditText mEditText = (EditText) popupView.findViewById(R.id.payment_field);
popupView.clearFocus();
mEditText.requestFocus();
popupWindow.setFocusable(true);
popupWindow.update();
final Spinner spinner1 = (Spinner) popupView.findViewById(R.id.transaction_spinner);
spinner1.setAdapter(new ArrayAdapter<CharSequence>(getActivity(), R.layout.support_simple_spinner_dropdown_item,getActivity().getResources().getTextArray(R.array.payment_list)));
Button btnDismiss = (Button)popupView.findViewById(R.id.cancel2);
btnDismiss.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
popupWindow.dismiss();
}
});
popupWindow.showAtLocation(popupView, Gravity.NO_GRAVITY, 0, 0);
}
});