How the ways that I can make this custom Label?
Is it a TextView with a background image?
You wont be needing a Custom View to create this.
Use a TextView with a background image and a Right Image property. Use RelativeLayout to overlap it over the coffee image.
In case you have to use it in more than one place extend a frameLayout to create a custom component.
It could be just a Imageview above another ImageView (coffee), which is above the TextView below.
You can look at Android layout and UI.
Or, it is just a mobile version of a web page, then you can look at html to find out how to do it.
Related
I was wondering if there is a way using which we can create 2 drawableLeft in our android layout. I have a scenario where i need to use 2 drawables. Anyone with any suggestions, drop them down please.
Edit: This is the layout that i want to design.
If you are using this view in only one place then you could just use LinearLayout with horizontal layout. and place 1 ImageView, TextView or Spinner [as per your requirement if the country code is selectable then you should use spinner instead of TextView for country code view] TextView and style them as needed. As in following picture:
If you need to use this layout in multiple place you could implement Custom View with the same layout file. Check how to create Custom View from this answer.
I want to make a custom layout like below view.
In this view I want to make TextView half sliced from one end and another ImageView from another end. So please tell me how to make such custom TextView and ImageView with diagonal clipped from one side.
With reference from this answer you can use this view and customize it horizontally instead of vertical.
Or you can also check for this code as well which something like below image.
Reference also available here
How do I create an auto swiping text in android? Something like those image slider in website but this is only text.
One text at a time and with sliding animation. Anyone have any idea, how to implement this?
Use ViewFlipper. ViewFlipper is introduced just for this purpose. Here is an example for the same ViewFlipper Example.
Another optinal, you can use this library Android Image Slider with custom SliderAdapter to using TextView instead of ImageView
In an Android app I have a background image and two buttons on it.
This is a partial screenshot:
I ask you for the best approach to click on the sinopsis button to show an overlay text, like this:
and also to click the fotos button to show an image slider, like this:
I don't want you to show me any code. I only need recommendations to know what kind of layouts or overlay views I should use to obtain the shown behaviours.
Thank you.
A simple TextView is enough. A TextView can have a background, translucent as in your case, or gradients, etc., and padding. You can fill it with Spanned Text so you could use hyperlinks, bold, colors, etc.. If you need scrolling, TextView also supports scrolling out of the box, but it'd be better to put it inside a ScrollView because the scroll will be smoother. In any case you don't need additional layouts.
You can just use a container layout (like LinearLayout. RelativeLayout, ScrollView, etc.. depending on what you want) and specify that to have a background image and then specify your drawable. You can then use TextView to display text. Don't forget though that you will have to create custom TextViews to achieve your design.
TextView can have transparent background and so, you can get the overlay effect.
Having a bit of trouble here. I've created a custom ImageView by subclassing ImageView and I'm able to get it to display if I simply instantiate my view and set the entire contentView of my activity to my imageview via setContentView(myCustomImageView)
But what if I want to just use my custom imageview as part of a larger layout? E.g., I want a button, a textview, etc and then my ImageView somewhere in there...
I tried doing something like programatically creating a linearlayout and then instantiating my special imageview and adding it via mLinearLayout.addView(myCustomImageView) but it crashes when I do this.
Am I missing something basic here?
EDIT: apparently you just use the full namespace of your custom view in the XML.
Why don't you put your layout in the XML?
You can add you custom View like this:
<view
class="com.your_package.myCustomImageView"
id="#+id/customView"
/>
You can find more useful resources on the Android SDK documentation site
Edit: Yes, you must use the entire namespace for your self defined views. For standard views you can omit com.android.widget because the SDK knows where to find them, but for your own stuff he doesn't.