set two titles? - android

I can setTitle("My Title"), but what I'm looking to do is set two titles... one on the left side and one on the right. How might I do that?
I currently have 2 textviews, aligned parent left and right... the textappearance is changed. But I'm hoping to get that into the titlebar using code so I don't have to use some background to simulate the titlebar.

You can define a custom view layout and tell the system to use it with:
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.text_title);
You can make your title view a RelativeLayout with two children positioned as you like. This should be done in onCreate() before calling setContentView(). See this thread for more discussion of using a custom view.

I don't think you can...I think Android only allows one title...but what you could do is
setTitle("My Title left My title right");
It's more than a little bit of a hack but it might work.
Full disclosure: haven't tried it.

Look at this tutorial for skinning / theming your titlebar

If you look at the Bluetooth Chat example on the Android Resources page, here, you'll see that it has exactly that sort of format. Details on how to access it are included there. It contains an XML edit and a few other simple modifications in your initialization code.

I'm playing around with some files right now to try and create this dual title bar.
It looks like this post would be helpful: my_own_titlebar_backbutton_like_on_the_iphone.
The comment written on this post at Thu Jan 29, 2009 5:55 pm contains the sample files, title1.zip, a second source file, title2.zip is a few comments below that one as well.

Related

Material Design TextInputLayout With An Attached Dropdown?

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.

Custom UI which looks like design image

I have a design Mockup of a remote control with 4 buttons and a Text Display. Now i want to create an Android Activity which looks like this mockup. How can i do this.
I think taking the design image as background for the activity is not the right way to do this (how would i make the buttons on the image clickable, etc...)
Can anybody give me a hint how to start here?
kind regards
You should create 9-patches(or patterns) for each graphic element on your layout for proper layouting on all available devices.
Then apply this patterns to your UI elemnt's(ImageView's, Buttons, TextViews) backgrounds.
Refernces:
http://developer.android.com/tools/help/draw9patch.html - 9-patch documentation
http://android-ui-utils.googlecode.com/hg/asset-studio/dist/index.html - 9-patch creation
http://developer.android.com/guide/topics/ui/declaring-layout.html - Layouting
You can use your background easily but the rest need to be done in Android.
First : download android sdk
second : create your project
third : code :)
If you're familiar with HTML, that should be kinda similar. You separate the cliclable parts from the background (the buttons), and make them ImageView, setting an onClickListener.
You'll need some Photoshop skills to do that, or ask a buddy designer to do that for you :)
Be careful with multiple screen support, since the background may get trickier to make it look right on every supported screen size.

Is there somewhere I can get the typical XML styles from the Android design guides?

This is driving me insane at times, why don't they just provide XML snippets of what they are showing?
Example:
http://developer.android.com/design/building-blocks/lists.html
It'd be nice to just know how they are using for the 2 lined list item layout.
SDK sources.
There are many examples, metrics and everything you need. Including drawables. Shamelessly copy them to your project keeping the copyright notice and that's all.
But of course, you'll need to study the code just a bit...
By the way, the 2 line list item seems to be a medium and small text, 4dp (or 8) between them, and 16 do margins on top and bottom. The left margin I think is 8dp.
There is also a standard R.layout including a two_line_list_item, but To put stuff on the sides you'll need to go custom. The header is the standard list header which is also available under R.layout.*
It follows the design guides. Nothing fancy.

How to design a iPhone like menu/button in android at the bottom?

I have googled this, most of the solutions are using:
1.TabHost with customized style which would cover the separate line between each tab to archive the requirement.
2.On the android developers website, there is a article is using Merge layout to put 2 buttons on top of the background image kind of archive what I want.(http://developer.android.com/resources/articles/layout-tricks-merge.html)
3.What about using button but style the looking like the example below? I don't need the selection, cause each item in the menu will be a button, which takes the user to another page.
I am wondering is there any other solutions apart from these two?
This is something want:
I don't need the menu likes a tab which has selected and unselected, they are better like a button always displaying in certain screen(activity).
Thank you.
You can use simple buttons, and provide any custom background for it. For such simple form as on your screenshot look for this link.
But #Janne write right thing - you should be very careful with transplanting controls from another platforms.

How to display default group icons in ExpandableListView?

I'm finding lots of discussion about how to replace the default group icons in an ExpandableListView, but I'm not coming up with anything on how to get the defaults to display in the first place.
The defaults (as shown here, if that's what they look like [new to Android, this is my first ExpandableListView]) will be fine with me, if I can get them to show.
I'm using the sample code from the article; I have no need for the embedded CheckBoxes at this time.
Any assistance is appreciated.
--EDIT--
Also, does anyone have any theories as to why the default icons show in the article (again, if that's what they look like--if someone could confirm that'd be great) but don't show for me?
If you are using custom layouts for your group rows the default icons are overridden by your layout. You'll need to add them to your layout in order for them to display.
you can changed default icon with your own icon as below.
android:groupIndicator="#drawable/image"

Categories

Resources