0

I have 1 Class that are opened two different ways. One way is it's opened from a sliding drawer and another way is as a dialog. Below you can see both of them. However, you can see that the edittext does not look the same in both. How can I modify the dialog style to look like the fragment?

Here is how it is made:

final EditText editTextView = new EditText(a); 
editTextView.setHint(R.string.hintNote); 
editTextView.setTag(tag); editTextView.setId(_id);

enter image description here

enter image description here

jcaruso
  • 2,364
  • 1
  • 31
  • 64
  • Can you please add the code for both of the editText – royB Aug 11 '14 at 18:23
  • @royB `1 Class, and 1 XML layout that are opened two different ways` as i stated they are both exactly the same, the only way they are different is how they are opened. – jcaruso Aug 11 '14 at 18:25
  • so add the code...There is no reason that the EditText will look different if it has the exact same properties. in short if you will add a code it will be easier to help you – royB Aug 11 '14 at 18:26
  • `final EditText editTextView = new EditText(a); editTextView.setHint(R.string.hintNote); editTextView.setTag(tag); editTextView.setId(_id);` there ya go – jcaruso Aug 11 '14 at 18:41
  • Didn't you say that you are using xml? – royB Aug 11 '14 at 18:42
  • Yes, my mistake. The question and been edited already. – jcaruso Aug 11 '14 at 18:43

1 Answers1

0

You can add the style attribute to the layout XML. They will both then use the style specified:

style="@android:style/Widget.EditText"
Randy
  • 955
  • 9
  • 16
  • Thanks Randy, Sorry i forgot to mention this particular item is built programmatically not through xml (I edited my question to reflect this). – jcaruso Aug 11 '14 at 18:43
  • In that case you may want to look at this answer: http://stackoverflow.com/questions/3142067/android-set-style-in-code Which says to inflate a template view. Just create a bare minimum xml layout with your edittext view and it's style attribute. Then inflate that template view when you create your new edittext view programmatically. – Randy Aug 11 '14 at 18:48
  • Thanks. Didn't know if there would be a way to do it without. – jcaruso Aug 11 '14 at 20:10