Customising a row of listview - android

I am a newbie to android.
I am trying to develop this UI. This is a single row of listview.
I have tried diff ways but not able to this.
Here in this pic, I know how to set that bubble background and use ninepatch and customise listview.
What challenge for me is I want to display some text here after button.
In case if the string is long i.e going to nextline than It should continue below the button.
Please suggest me how to move forward.
Should I use two textviews and check if the first textview is filled than further string should be displayed in the second textview or any other way.

You can use ArrayAdapter or BaseAdapter. Check out the following links
most recommended
link
tutorial1
tutorial
tuorial3
EDIT:
Use seperate Linear Layout for both the view. It should do the trick

Related

Hi I am trying to create a e commerce app UI design like the image below

enter image description here
I have a activity and i have to display multiple fragments cards as shown in the below image.How do i organize layouts.
Please help me how to achieve the below design.
Add a view pager at the place where your images re being shown if you want to change them on swipe. Otherwise you can just put an image view and a text view to show the data of first item and replace the image and text on the imageview and textview one by one for all the items whenever you need. Let's say you can change the items after a certain time by using "TimerTask()".
This is the solution for that highlighted blue part. If I am not sounding appropriate then explain your question a little so I can help you.

Give a possible way to display data

tell me how best to implement the following representation of information
20.10.2014
7:00 some text
7:30 some text
18:00 some text
21.10.2014
7:20 some text
7:21 some text
7:22 some text
22.10.2014
7:20 some text
I know the following solution - ExpandableListView but then the children can curl up. but I do not need or TableLayout with TableRow but I need to fill in the data from the array and implement the click event for each element except the parent.if you ask a stupid question and give direction where to look, I'll delete it
even without the events. usual display of text from a file in a form
Option 1: Use Multiple Views in ListView
See this tutorial and this answer (it is harder one you will need a simple adapter).
It will help you in creating a adapter with two different layouts.
Option 2: if you don't want it to be so much complicated use simple base adapter and create a view with both date layout and event layout and change it's visibility.
Option 3: In More Simple way create a mutliline text view in scrollView then make your text more formatted using spannable string.

Multiple images in one TextView?

I would like to know what is the best way to place multiple, small(all of them the same size) images into one TextView? From what I've found, the best way would be to use Html, but how? All of my images are offline ones, so I can copy them for example in the raw folder, if that is the right way. Can anyone point me into the right direction, or show a similar thread, which I did not find? OR, is there any better approach, like don't use TextView, but something else, which can be solved in the layout files, and dynamically filled with images?
Btw, the whole thing I want to do is:
I have a ListView, filled with items
each item has different attributes, which I currently print in plaintext(I want to replace theese with images
atm, I use one separate TextView to display theese attributes
the number of attributes are random, but at least 1, and typically 3-4(so 1 picture at least, 3-4 typically)
cheers
Sounds like you are making smileys in a chat/message application, am I right? ;)
Anyway, the way to go is to use an ImageSpan. You can use a Matcher to find all text combinations you want to replace, and use a SpannableStringBuilder to add ImageSpans to the positions returned by the matcher, this will replace those characters with the image defined by the ImageSpan.
Why not just create a layout that can be used for each row of your ListView and populate the different elements of that layout based on the data for the row?
For example, if each item has a maximum of 4 attributes, add four ImageViews to the layout, and set their drawables and visibility in getView based on the position passed in.
One thing is for sure : You do not want to put your images inside your textview.
A textview can contain a background but should not be used to contain images.
What you want to do is simply design an item layout that will be used by your adapter to fill the listview.
This item layout will contain a textView that contains only your text and your images. Then in your listAdapter you'll simply show or hide the images you want.
Try to base your layout on a RelativeLayout that will allow you to have a simpler design and even overlap some elements(the images could overlap the textview for example)

Android - How to structure a layout that has two dynamic texts and then a list

I am trying to create a screen where I get two items from SharedPreferences and display them to the screen, and then display a list via an adapter.
What I am not sure about is how to structure the layout xml file for this. Any suggestions how to do that?
Thanks!
You can have the main layout with a listview. Then you can have a sub layout for each row of your list. This row layout, let's call it row_layout.xml may have two text areas if your items are text or it may have a text area and a checkbox button if that's what you want. Basically, whatever you want to display in a single row of your list.
Read up a tutorial, here's one: http://www.vogella.de/articles/AndroidListView/article.html
Take a look # MergeAdapter, you can also create a view only listitem and add these item as header to the list
I am not sure what you mean. Are you asking for examples of layouts with two textviews that can be updated via sharedprefs, with a ListView in the activity? Or just suggestions? An easy way to get started would be to use the Eclipse Android plugin that has a layout designer in it. Here is a tutorial on how to use it http://mobile.tutsplus.com/tutorials/android/android-layout/ Its pretty easy and straight forward.

Image in a List view in Android

Hey all,
I know that this question has been asked many times in this forum itself. But I am not able to get a working solution out of any one of them.
My problem is that I need to create a list view with images. The content is static. Eg: Lets say i need to display 5 rows of data and I have 5 images to go with these rows. All i need to do is to display them in a list format!
Simple right??
Thanks in advance!
Hey nice to see somebody facing the same problem as I did.
Here is the very simple solution for that.
Make a ArrayList add your five elements in that named COUNTRIES.
create one list_item.xml file with one ImageView named imageview and one TextView named textview in a linear layout(This layout will repeat for your each row in ListView).
Dont forget to set image in ImageView to any defult icon or something.
in your class that extends ListActivity simply enter following line and you are done.
setListAdapter(new ArrayAdapter<String>(getApplicationContext(),R.layout.list_item,R.id.textview,COUNTRIES));
In case you stuck anywhere you can ask.
You need to write a custom layout for the rows and pass it to the Adapter that defines the content of the list (you most probably want to write your own, but there may be some predefined ones).
See e.g. this TweetAdapter
that uses this layout
The left screenshot shows how this looks like.

Categories

Resources