1
I’m developing a form where I added the spinner, the code went all right, I was able to add and get the selected item, the problem is in the visibility of the spinner. It only appears on the screen when I click on top, and right after I choose the option it returns to be invisible. I’ve done everything and do not find the error.
Here is the xml:
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/spinner"
android:background="#ffffff"
android:layout_above="@+id/endereco"
android:spinnerMode="dialog"
android:visibility="visible"
android:theme="@style/Animation.AppCompat.DropDownUp" />
And the form class:
public class Reclame extends Cronograma implements AdapterView.OnItemSelectedListener{
Spinner option;
Button btnSend;
EditText Nome;
EditText Message;
EditText Endereco;
EditText Telefone;
EditText Email;
@Override
public View onCreateView(LayoutInflater inflater,
ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.reclame, container, false);
Nome = (EditText) view.findViewById(R.id.nome1);
Message = (EditText) view.findViewById(R.id.msg);
Endereco = (EditText) view.findViewById(R.id.endereco);
Telefone = (EditText) view.findViewById(R.id.telefone);
Email = (EditText) view.findViewById(R.id.email);
btnSend = (Button) view.findViewById(R.id.send);
option = (Spinner)view.findViewById(R.id.spinner);
option.setOnItemSelectedListener(this);
ArrayAdapter adapter = ArrayAdapter.createFromResource(getActivity(), R.array.option, android.R.layout.simple_spinner_item);
option.setAdapter(adapter);
btnSend.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String nome = Nome.getText().toString();
String message = Message.getText().toString();
String matricula = Endereco.getText().toString();
String telefone = Telefone.getText().toString();
String assunto = option.getSelectedItem().toString();
String ema = Email.getText().toString();
Intent email = new Intent(Intent.ACTION_SEND);
email.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
email.putExtra(Intent.EXTRA_SUBJECT, assunto);
email.putExtra(Intent.EXTRA_TEXT, "Nome: " +nome +'\n'+ "Endereço: "+matricula + '\n'+ "Telefone: "+telefone + '\n'+ "E-mail: "+ema + '\n'+ '\n'+message);
email.setType("message/rfc822");
startActivity(Intent.createChooser(email, "Selecione o serviço de e-mail:"));
}
});
return view;
}
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
TextView mtext = (TextView) view;
//Toast.makeText(getActivity(), "Você selecionou: "+mtext.getText(), Toast.LENGTH_SHORT).show();
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
How do I fix this problem?
I think it would be better to expose also the code that has related to this
– Miguel
Retire
android:background="#ffffff"
or switch toandroid:background="#000000"
– ramaral
Taking advantage of the Miguel hook, how do I leave my form with a more attractive theme? I’m finding it half "dead". I’ve seen better forms done there.
– Carlos Diego
The problem is that the color of the spinner font is white. You have some custom style applied?
– ramaral
I have no extension
– Carlos Diego
Solved? You can show the xml of the form layout?
– kleiser sarifo
It was solved yes. It was the same color as the background.
– Carlos Diego