I\'m trying to use the TextView
constructor with style like this:
TextView myText = new TextView(MyActivity.this, null, R.style.my_style);
The accepted answer was great solution for me. The only thing to add is about inflate()
method.
In accepted answer all android:layout_*
parameters will not be applied.
The reason is no way to adjust it, cause null
was passed as ViewGroup parent
.
You can use it like this:
View view = inflater.inflate(R.layout.view, parent, false);
and the parent
is the ViewGroup
, from where you like to adjust android:layout_*
.
In this case, all relative properties will be set.
Hope it'll be useful for someone.