Is it possible to implement style="?android:attr/textViewStyle" dynamically?
On May 20, 3:10 am, n5r11 <[email protected]> wrote: > This seems to be working.. > android:background="@null" removes the background, but the text color > stays the same. It takes another explicit android:textColor="@null" to > fix that. I guess those are the values that are set in the > editTextStyle, but not in textViewStyle, so they stay the same after > style="?android:attr/textViewStyle" and need to be nulled-out > explicitly. I'm not sure what's really going on here, but this seems > to be a clean solution to this problem. > The documentation should be more explaining, with more complete and > thought-out examples.. > > Thanks people - a lot! > > PS: Don't trust the layout tab in the xml editor too much.. > > On 20 мај, 02:53, Jeff Sharkey <[email protected]> wrote: > > > This is probably because theEditTextstill inherits an > > android:background value from the default system Theme, because the > > textViewStyle doesn't force a @null background. > > > Try adding an explicit android:background="@null", which should remove > > theEditText9-patch frame and any padding that comes with it. > > > j > > > On Tue, May 19, 2009 at 5:19 PM, n5r11 <[email protected]> > > wrote: > > > > I've tried all that you suggested, and nothing happens?EditTextstill > > > looks the same, both in IDE and when compiled on emulator. > > > > <EditText > > > style="?android:attr/textViewStyle" > > > android:layout_width="fill_parent" > > > android:layout_height="wrap_content" > > > android:text="Neque porro quisquam est qui.dolorem.com ipsum" /> > > > > <EditText > > > style="@android:style/Widget.TextView" > > > android:layout_width="fill_parent" > > > android:layout_height="wrap_content" > > > android:text="Neque porro quisquam est qui.dolorem.com ipsum" /> > > > > I see I'm not the only one with this problem: > > >http://groups.google.rs/group/android-developers/browse_frm/thread/29... > > > > n5r11 > > > > On 19 мај, 02:05, Jeff Sharkey <[email protected]> wrote: > > >> You should actually be using an attribute instead of a direct reference: > > > >> style="?android:attr/textViewStyle" > > > >> The underlying @style reference isn't public, but the above attr is. > > > >> j > > > >> On Mon, May 18, 2009 at 4:30 PM, MrSnowflake <[email protected]> > > >> wrote: > > > >> > Might be: style="@android:style/Widget.TextView" > > > >> > Otherwise, make a TextView and anEditTextand change the GONE state > > >> > of them. > > > >> > On 18 mei, 19:33, Raphael <[email protected]> wrote: > > >> >> Try this: > > >> >> android:style="@android:style/Widget.TextView" > > > >> >> R/ > > > >> >> On Sun, May 17, 2009 at 3:31 PM, Nikola Radosavljevic > > > >> >> <[email protected]> wrote: > > >> >> > Note: I had troubles posting to android-beginners group, so I came > > >> >> > here > > >> >> > hoping this will work. > > >> >> > Hello there, > > > >> >> > I want anEditTextto look like TextView but still behave like > > >> >> >EditText. I've tried applying TextView style to myEditTextin my > > >> >> > layout.xml file, like this: > > > >> >> > <EditText > > >> >> > android:id="@+id/lipsum" > > >> >> > android:text="Lorem ipsum" > > >> >> > android:style="@android:style/Widget_TextView" > > >> >> > /> > > > >> >> > ..but I get an error within xml editor: "Error: No resource found > > >> >> > that > > >> >> > matches the given name (at 'style' with value '@android:style/ > > >> >> > Widget_TextView')." It is strange because @android:style/ > > >> >> > Widget_TextView definitively exists - I double checked it in code > > >> >> > via > > >> >> > android.R.style.Widget_TextView. Another strange thing is that I > > >> >> > don't > > >> >> > get android:style offered in the xml editor while typing? There is > > >> >> > android:id, android:text and everything else.. but not > > >> >> > android:style?! > > > >> >> > Note: I consider the hard way (makingEditTextlook like TextView) to > > >> >> > be: extendingEditTextand overriding it's onDraw method. > > > >> >> >Nikolar > > > >> >> > PS: Check out > > >> >> >http://developer.android.com/guide/topics/ui/themes.html#styles. > > >> >> > Why are id and style written without android: namespace? > > > >> -- > > >> Jeff Sharkey > > >> [email protected] > > > -- > > Jeff Sharkey > > [email protected] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

