1 line text view next to two line text view - android

I was wondering if this can be implemented in android.
So there are basically two text views one is the name / other is the "open" .
The name can extend more than one line and the "open" should be placed adjacently .
One way is to dynamically break the name text view into two and place "open" next to it. But I don't find it good solution . any direct way to implement it ?

You may set the following to your TextView:
android:drawableRight="#drawable/your_image"

You could create ListView and use
setCompoundDrawablesWithIntrinsicBounds in the layout for your Adapter. Create a Boolean to show when a pizza joint is open and when to show the Drawable.
Something like this:
if (isOpen){
yourTextView.setCompoundDrawablesWithIntrinsicBounds(0,0,0, drawable);
}
Of course, this would require you to make an "open" image, but the way I see it, this would be the easiest way.

Just a thought .
It can be done via setting text using textView.setText(Html.fromHtml(styledText));

Related

Android - how to integrate text into image

I want to create an Activity in my app that has an image chosen by the user and two or more EditTexts below said image where the user writes something.
After that, text from those EditTexts should be "integrated" into that image, let's say one on the top and one on the bottom of the image. I wrote integrated because I want the text to be a part of the image - those two need to become only one image so I can use an intent to send it to someone's email.
Sorry if the question is badly asked, I just didn't know how to formulate what I wan so I hope you got it.
Please follow steps
Create one framelayout with TextView and ImageView
Put EditText box implement TextWatcher
In onTextChanged method of textwatcher set text in textview.
You can create Bitmap of framelayout
Sounds like you are looking for ViewOverlay
The first example in this link does exactly what you want to do.
http://flavienlaurent.com/blog/2013/08/14/viewoverlay-when-how-and-for-what-purpose/
Have you tried using a custom/compound view?

Android, Simple box inside a button?

I want to have a button like the one in the link below. How can i achieve it just by java code or xml? By the way it's going to be of a different color when pressed. I've explored similar posts but none helped. Any help appreciated.
The button which i want
Just make a View with large rectangle and add what you want(e.g. Label contains 'Number Of Students' and/or something else) in the view.
Then, add onClickListener to the View.
To change clicked colour, refer to here

How can I personalize my textView?

Yesterday I asked a question about the TextView. I read and I see that it's very difficult to understand. So, I'm sorry.
Now I explain better my problem:
I try to personalize my TextView. I tried two different things:
I use photoshop, I made an image text and I use it as a drawable. The image re-sized isn't with right quality
I try to use the text of TextView, but I can't change the family of the text (the app crashed). Then I don't know how to set gradient as text color and border in the text.
What can I do?
Edit: yes! For the point 1 I use an ImageView inside of TextView. In point 2 I use TextView. I have problem in both situation!
I think to customize textview (any view) you have to implement your own custom view by creating your custom class.
Here is link for custom text view,i hope i will find it useful
http://www.jayway.com/2012/06/25/creating-custom-android-views-part-1-extending-standard-views-and-adding-new-xml-attributes/

showing text and image both while displaying list of applications in android

i want to create a home screen application where the applications looks like carousel , and i am able to do it . The problem i am facing is that in my application only the applications icon are getting displayed the text is missing in it , where as my requirement is that i want to both the icon and text to be displayed together.
my application displays same as the above showing image.
i want text to be combined with it as above image.
please help me.
Thanks
datta
So the simplest thing to do would be to create a Compound Control. This compound control would essentially be a LinearLayout with both and ImageView and a TextView in it. Then, where ever you use a CarouselImageView in your code, just use your new compound control instead.

Radio group layout design in android?

I need to create the radio group as shown in diagram. Two thing i don`t know how to implement
1) the hint string below Main String(Ex: here 1 Minutes ,below some description is provided) , i don`t know how to put the description under the string.
2)separator line between two radio button. How to describe such separator line.
I don`t know whether it is possible or not.Anyone suggest some idea here.
For me, this looks like a ListView with custom ViewAdapter. In that case you can define the description text as you wish...
Yes Throben is right. You have to create a custom ListView. See the example of Custom List View here. or at Vogella Articles

Categories

Resources