Is there any way to search for a component by name in the Android Studio layout designer palette?
Currently it is just a list of components grouped in some categories but there is even no sorting in the single groups.
I try to find the android.widget.SearchView component but fail to do so. I'm not sure whether I just miss it or it is not here.
It's under Containers.
Yes it does not make sense.
And the list is hardcoded here https://android.googlesource.com/platform/tools/adt/idea/+/master/android/src/com/intellij/android/designer/model/views-meta-model.xml
see the end of the document, and you will see the groupings. And yes this is very outdated, having fill_parent instead of match_parent everywhere.
Related
I can't seem to find any good resource or guidelines for making the about section of an app I'm making.
Using a Preference xml seems not a good idea to me as there are no preferences to make. I need to just display textual information. The only interaction required is for showing those Open-source licenses, TOS, the version, etc.
See this about page of the Google app:
I have no clue what is a good (may not be the best) way to implement like in the above linked image.
Any help would be appreciated.
If you want to implement something like this your best bet would be using a RecyclerView with an DividerItemDecoration (for the grey line). The item of your RecyclerView simply needs to support a Title and a Subtitle. The Subtitles visibility should be gone by default, so your item (which should be wrap_content) is not unnecessarily stretched. This way you can reproduce the screen of the image you have linked
If your about page is a static one use constraint layout as parent and textviews as children. But if it is a dynamic list use recyclerview for better performance.
My question is about the ConstraintLayout because since Android Studio 2.3, when I want to create a new Layout, the default Layout in my xml file is the ConstraintLayout.
Is the ConstraintLayout the new standard ?
What about the others layouts (LinearLayout, GridLayout, RelativeLayout,...) ? Will they be depreciated ? Do I have to Convert all my layout using the converting tool ?
What is the best practice? Use as much as possible the ConstraintLayout ?
This is a bit confusing because I don't like to use the visual editor and it's a quite difficult to do ConstraintLayout using the code editor.
when I want to create a new Layout, the default Layout in my xml file is the ConstraintLayout
Whether or not a ConstraintLayout is created depends entirely on what templates you are using.
Is the ConstraintLayout the new standard ?
It is what many of the Android Studio 2.3 templates use. Those templates are merely examples used a starting point by some developers. Those templates differ on older versions of Android Studio and most likely will change again in the future.
What about the others layouts (LinearLayout, GridLayout, RelativeLayout,...) ? Will they be depreciated ?
That is very unlikely.
Do I have to Convert all my layout using the converting tool ?
No.
What is the best practice? Use as much as possible the ConstraintLayout ?
Use what works for you. Consider ConstraintLayout as a candidate, but do not feel obligated to use it. In particular places where you determine that layout performance is critical (e.g., scrolling lists), if you determine that your existing approach is not performing well, consider testing ConstraintLayout to see if it helps (it may or it may not). Also note that ConstraintLayout itself does not handle all scenarios — for example, I have yet to see a working means of implementing a TableLayout structure (with automatic column sizing) using a ConstraintLayout.
I am in a situation like i have to generate UI Controls like Button,Switcher,Progress Bar, Label text etc based on my list Items .
I am looking for a way to generate the controls in a View and add Views with generated controls in a Layout .
Can anyone give me a proper way to do that?
Why not to use Fragments?
Google docs about this here
and little tutorial here
You may want to take a look at the Metawidget source code. The Android version of Metawidget makes extensive use of generating Views and Layouts at runtime (e.g. see org.metawidget.android.widget.widgetbuilder.AndroidWidgetBuilder). You may even find Metawidget itself will suit your needs (it's designed to be embedded into projects for use-cases such as this).
I'm trying to do minor tweaks to the layout of items inside an ActionBar, and hitting a lot of problems. It would help if I knew (or even better: could override!) the layout which Android is using for the ActionBar itself.
(Android's layout system doesn't allow you to fully control layout of "items" direct from the item itself - all the options are enabled/disabled based on what type the parent/container layout has)
So, for instance...
try to make a custom ActionView that takes "all remaining space" (because you have no title / don't need a title)
...everything breaks. There are lots of workarounds, all of which have their own bugs (I've tried 3 from SO already, and they all break on different versions of Android / different handsets)
this would be TRIVIAL if I could set the ActionBar's layout to "RelativeLayout" and use "layout_toLeftOf" etc
...but the docs don't seem to answer this, nor do they provide a way of setting it. Any ideas? I don't want to have lots of hardcoded, broken code to workaround the API (because it'll make maintaining this app a nightmare :( )
Have you looked at ActionBarSherlock? It's a support library extension that implements action bar on all versions of Android using single API. Also, when it comes to layouts, I often find it very useful to look at the source code. You can find action bar layouts on the very top of the list here.
Load the view hierarchy and then you will be able to see the views that compose any layout.
http://developer.android.com/tools/debugging/debugging-ui.html
I am very new to Android development and am having some trouble. I am creating an XML file using Eclipse, both the Graphical Layout feature is what I'm having trouble with.
Also, I am working in Android 2.3 for compatibility reasons.
I am wondering if there is a layout which enables me to place buttons or text fields or any attribute where I want to put them. This may sound stupid, but it seems that every layout has some sort of order in which it lets you add attributes, and whenever I try to drag them elsewhere on the layout things just get very very messy.
If what you want is an AbsoluteLayout, this has been deprecated since Android 2 (IIRC). You can try using the RelativeLayout, which let you position freely your widgets. Else, if you only use LinearLayout, then yes the widget will be positioned in a strict way.
use Relative Layout. I recommend that you read up on Android layouts so you understand why, what and hows of Android way. There are some good tutorials that I found helpful. TutsPlus: Android Layouts
There is also a very good video from Marakana.
Marakana: Android Bootcamp
If you are just starting out with Android check other tutorials/videos on Marakana. They are a very good resource for beginners.