I'm looking to create an EditText that looks like the following & was just wondering if it was possible & if anybody might be able to provide example XML code to create the following.
Note: The cursor doesn't have to be blue, if it can be that's cool, but definitely not required.
This is just an EditText with a custom background (the underline with the curved shape). You would just use a standard EditText, and add your custom drawable (however you make that - either a PNG, 9Patch, ShapeDrawable, etc) as the "background" element. The text label would just be a TextView you put in your layout above the EditText.
However, I would steer you to use the new "TextInputLayout" provided in the Design Support Lib. This has a ton of built in functionality, and as a bonus, your app will be consistent with Material Design standards.
Related
Is there a Material component that will easily let me set the left of a TextInputEditText to be a dropdown like this image below? If not, I can create something, but wanted to see if anyone knew more about Material components before I start doing too much custom work. Looks custom to me, though.
With material component, Google has removed spinner from its UI Elements.
Preferred way to do it is TextInputLayout along with AutoCompleteTextView just like Ashu has mentioned in the comment section.
Here is a more thorough article, which can help you in implementing AutoCompleteTextView.
https://blog.usejournal.com/there-is-no-material-design-spinner-for-android-3261b7c77da8
So far, both answers say to use AutoCompleteTextView. However, that doesn't answer my question. As you can see in the image I posted with the question, only the left side is a drop down. The right side is just a normal text input that isn't affected by the drop down.
However, I think it is safe to assume there isn't a component that will do this for me easily and that it would indeed be custom work to make these two components appear to be one single component.
Is it possible to create Material Design views (like button, textView, ...) programmatically?
like
AwesomeButton btnTest=new AwesomeButton (context);
i want full featured library like rey5137 but without XML usage and support old android(maybe Android 2.3 and up).
material design is all about different combinations of items in xml. you cannot design without xml. it is not java swing don't forget, whatever you want to design their base should be on drawable or layout folder, not on java code
update for the edited question
in your example, you say AwesomeButton, in order to have something like this, you need to have a library, which also has xml design file including all those fancy visual effects. If you don't design how are you supposed to create a pre-designed button.
chamran, you are making it complicated my friend, you can't design a button via code, you have to have a xml file for your own custom materials. Even the default button has a xml.
I wanted to create a custom text view. A little bit advance just as the text editor found here in StackOverflow, I can insert text and even images. I wanted to name this as WordView and create this as a library so I can reuse this across multiple projects.
Unfortunately I am not so sure if the base class allows this. I need a way to insert/paste images directly in the EditText. I am planning to write a custom View, although it seems laborious, I am not quite certain if this is possible at all and if I am going into the right track.
Have anyone tried similar before?
According to the Android Documentation for a TextView You can have a drawable object inside the TextView in the following ways
DrawableBottom
DrawableEnd
DrawableLeft
DrawableRight
DrawableStart
DrawableTop
There are other methods you can use, check out:
1. Programmatically set left drawable in a TextView
2. How to programmatically set drawableLeft on Android button?
3. http://androidsbs.blogspot.co.za/2013/12/androiddrawableleft-set-drawable-to.html
You could possibly implement this using HTML. I'm not sure about the paste functionality but generally it might work.
The EditText fields in the Android emulator have an inner shadow and rounded corners. The same app on my Samsung Galaxy shows the EditText fields flat looking and perfectly rectangular.
I realize there are differences between the versions of Android but is there a way to influence these properties of EditText fields?
In most cases it is better to use the default style, this is what the user expects.
You can completely define the look of your UI fields. If you want a fully custom look, go for a 9-patch background image. You can also define a look with xml drawable resources, which allow for rounded corners and gradients.
If you define the look, it will look that way on all phones. the highly variable UI changes between manufacturers and carriers is, in my opinion, one of the most frustrating issues with Android.
Most clients we have worked with has a complete UI spec. While there is an argument for using "the default", most commercial apps do not. At least for the style stuff. I would still argue that menus, notifications, preferences, etc should be Android standard.
When I place things like text boxes they are fixed in one position and I can't move them around easily.
How can I edit the style and maybe put an image at the top of the text boxes and give the app a neat and pretty little layout?
Thanks
Use RelativeLayouts instead of LinearLayouts (i assume that you are using them) which allow free positioning.
To modify the theme/colors, read Applying Styles and Themes.
Create 9-patch graphics and assign them as backgrounds.
I am unsure if this is what you are looking for,but you can arrange the object on the layout from the xml files in res/layouts/ folder.Do not forget to follow the UI guidelines provided by google for android development. Also you can create custom themes for you app if you do not like the default template.