I use a ListView for text-items in my APP. But I have one problem: if a put a text with numbers, the numbers are convert to a link to show the phone dial screen. Can I disable this?
If you are defining you list items as TextViews in a layout file then use android:autoLink="none" to prevent emails/urls/phone numbers etc from being shown as clickable links.
You should also be able to use setAutoLinkMask (0) on each individual TextView list item if you are creating/adding them manually.
I haven't tried it myself but I think that's how it works.
It looks like this:
I have a standard ListView with a Image and a TextView (thats one item).
Related
I am working on a recylerview which contains several edit text and 2 textview beside each edit text. Initially I want empty edit text when activity is loaded, after that putting some values in 1 or more edit text randomly. I do not want to loose the value on scroll up or down. Please provide a solution for that if possible.
Basically, I have a bunch of custom TextViews and a set of data. I programatically inflate the textviews and set their texts according to my data. I want to add my views to the right of each other, and when there is no room horizontally, it will add a new row below. However, I am not sure what layout/view to use to achieve my goal.
Example of what I am trying to achieve:
enter image description here
Please Help!
I would use the Flexbox Layout library from Google. It does exactly this for you.
I have say 3 images in a view and want to display a list upon selecting any of the images. Upon selecting an image a list shows up adjacent to the image that was selected. Only one list can show at a time, so if a list is visible next to one image and another image is selected a new list is built next to the selected image and the existing list disappears.
The lists are built using arrays.
Should I use listview or listactivity. Or might there be a better approach to doing this.
Thanks,
you can use Recyclerview List for your mentioned problem
The easiest way, according to me, is to make the layout as you want with the images and with listviews and put initially visibility gone on the lists. When a image is clicked make that list visible (setVisibility(View.VISIBLE)) and the other ones gone (setVisibility(View.GONE)).
This is the most straightforward solution.
I have came across these type of questions a lot, But none of the answers solved my problem.
I am developing a mobile shopping application model. I have a custom ListView with an ImageView, and EditText(quantity), 2 Buttons for increasing and decreasing the quantity, 3 TextViews one for item Name and other two for prices and I am dynamically loading a number of Buttons for NetWeights based on the requirement through Java code and I am implementing it using CustomAdapter(Class) extending BaseAdapter and getView().
Problem 1:
When I use the condition if(convertView==null), setTag(holder) and getTag(), the dynamically loaded Buttons are getting duplicated and gets doubled in number.
Problem 2:
While scrolling the custom ListView I am loosing my data on 2 of the TextViews while the other TextView(name) is fine because in that TextView I don't Change data on runtime. On the other two TextViews(prices) I change the data on runtime using ButtonClicks(increase and decrease) where at that time when I scroll the two TextViews, it looses its content. Actually I had this same problem with the EditText(displaying quantity), I solved it using the TextWatcher by getting the value and passing it in an array and again setting it. I used the same technique (i.e) the TextWatcher for the TextViews But that did'nt Help. I also tried removing the TextWatcher and setting the text with the array and adding TextWatcher. Still I am loosing my content in those TextViews
Any Suggestions??????
Problem 1:
While using ViewHolder (setTag(), getTag()) we will be reusing the views.
For example: Let's say we have 10 listview items and the screen can display 3 items at a time. Lets say we add 2 buttons to list item 1. First time when we load the listview we will see two buttons. Lets say now we scroll down and come back to the list item 1 again, as we are reusing the views, we already have 2 buttons and if we have the code to add buttons using getTag() then 2 more buttons will be added. I think this may be causing the issue of button duplication. To add little more information, list item 1, list item 4, list item 7 and list item 10 will all use same view, as our screen in this example can display just 3 items.
Problem 2:
One idea is to store all these text values in the arrayList.
For example, lets assume we have one textView inside each list item that can be incremented/ decremented. Set textWatcher on this textView and whenever text changes add it to the arrrayList using 'position' as the index. Inside getView method when you do getTag() try to set the textView using previously stored text (that was stored inside the arrayList)if exists.
I'm trying to design a page for my app that will be a list of places. I need each list entry to have a picture, text below, short description, and some other info, address
The list view fragment examples that I've seen simply have one or two lines which won't really do what I need it to... where do go from here? I'm not sure what to search for, nothing useful has come up so far..
You are going to need to make a custom ArrayAdapter.
Check out some of these examples:
Android Custom Listview with Image and Text using ArrayAdapter
Android Custom ListView with Images and Text – Example
Customizing Android ListView Items with Custom ArrayAdapter