How to change EditText look programmatically? - android

I want to change default edittext look(Image:Look which i need to change) from box like look(Image:Look whic i need)...
This must be done programmatically,...I dont know how to do this...please help me
Edit : Sorry typed the title wrong
Edit:Why this is not a useful question??
who voted this question down...anybody please fix this by voting up...I cant post questions

I would create a 9patch image and then set the background drawable programmatically. Please look at this tutorial and see if it's of any help.
http://wptrafficanalyzer.in/blog/changing-background-color-and-border-color-of-an-edittext-widget-using-state-list-in-android/
EDIT: doing a little more research I've found that you can get the desired look&feel by just creating a shape in drawable.xml file. You can find some samples here: http://letustech.wordpress.com/2012/09/16/customedittext/ ... then just call setBackgroundResource on the EditText to set it programmatically.

Create a 9 patch drawble and use that as your background.Call setBackDrawable() to use it

Related

How to show html code on button in Android and style it

I want to put html codes on buttons as text in my android application and style them.
For ex: I want to create a help button and put "❔" as text to it.
Below is the code I have written in the activity.
Button btHelp=((Button) findViewById(R.id.btHelp));
btHelp.setText(Html.fromHtml("❔"));
But if I want to change the color of it. I tried by giving span and font in the above statement but it is not applying.
Can you please let me know how to give the colors for this. Also let me know if there is any better way to do so.
Thanks,
If you want to change text color, simply use:
btnHelp.setTextColor(Color.parseColor("#FF0000"));
or
btnHelp.setTextColor(Color.RED);
or
btnHelp.setTextColor(getResources().getColor(R.color.red));
But that won't work with emojis like your White Question Mark Ornament. If you want to change that question mark color, you will have to make a drawable file with button drawables (png) that have that question mark with the color you want. You can do that from photoshop or any other program.

Android: Button Drawable Default

I am trying to use the default Theme.holo button drawable for Android but I cannot find the standard one that's used whenever you create a button. I have tried checking everywhere in the sdk\platforms\android-19\data\res\ but to no avail. Any help searching for it would be appreciated. Thanks in advance!
It looks like the one on the left here, but is mildy transparent.:
The drawables for your theme are located in:
platforms/android-*/data/res/drawable-*
See this link
As it says you can find the drawables in
yourandroidsdkrootfolderpath\platforms\android-11\data\res\drawable
(ex:D:\android\platforms\android-11\data\res\drawable)
EDIT
Correct path
yourandroidsdkrootfolderpath\platforms\android-8\data\res\drawable-mdpi

Change the Text color and Text size in Tab Widget...?

I want to change the Text color and Text size in the TabWidget. Is it possible directly without taking TextView or not.
Please tell me.
Thanks in advance!
Yes you can completely customize how you want the text and background of a tab in a TabHost to appear. See this blog for a very good tutorial on how to do it: http://joshclemm.com/blog/?p=136
If you want to make custom tab indicator, here is something you might need to look
Here is a previous answer on a similar question with great tab customization possibilities. Android - Remove Icon from TabHost/TabWidget

changing EditText

When I change the layout_height of an EditText field in Android, the nice looking gradient becomes a hard gray line as you can see here:
Is there a way to either fix or disable this gradient?
thx
Ben
You may want to just give it a different background, using a nine-patch presumably. (I have noticed this too and don't like it either! :) )

Android dynamic background

I am somewhat of a new android developer and have a question regarding changing the background dynamically at runtime.
What I want to do is set a background color in a LinearLayout Tag, and later change that background color in my activity class. This code below is not working. Am I missing something or is this the wrong approach for trying to change the background color in a linear layout
LinearLayout lv = (LinearLayout)findViewById(R.id.ChoiceLayout);
lv.setBackgroundColor(0x000080);
Thanks in advance
First thing I've noticed is that your color has ALPHA = 0x00. Which makes it transparent. Try changing to
lv.setBackgroundColor(0xFF000080);
AFAIK, that should work fine. Use hierarchyviewer to try to diagnose what is going wrong.
already answered in another post , unfortunately i don't know that link but know the solution.
use
lv.setBackgroungColor(GetResources().getColor(int color));

Categories

Resources