listitem

removing RecyclerView items

自作多情 提交于 2019-12-03 09:44:41
问题 I have a RecyclerView which is adding items each certain period. When adding objects, if list items are more than (lets say) 500, then the first items will be removed and the new items will be added. If the RecyclerView cannot scroll down any more !recyclerView.canScrollVertically(1); then, after adding new items the RecyclerView will smoothScroolToPosition() to the last position. Where is the problem? Okay, if ReyclerView is at the middle (not bottom, not top) when removing old items, it

Centering floating list items <li> inside a div or their <ul>

半城伤御伤魂 提交于 2019-12-02 22:52:02
HTML: <div class="imgcontainer"> <ul> <li><img src="1.jpg" alt="" /></li> <li><img src="2.jpg" alt="" /></li> ..... </ul> </div> I'm coding a simple gallery page by creating unordered list and each list item of it contains an image. ul li { float: left; } I set the width of the container as "max-width" so I can make possible to fit the list items (images) to the browser width.. meaning that they will be re-arranged when the browser window re-sized. .imgcontainer{ max-width: 750px; } Now the problem is those images or list items are not aligned to center, they are aligned to the left of

returning clicked li class in an ul javascript/jquery

[亡魂溺海] 提交于 2019-12-01 12:40:44
My code (the html page): <nav> <ul> <li id="homeLink"><a href="#">Home</a></li> <li id="rekenLink"><a href="#">Rekenmachine</a></li> <li id="bakkerLink"><a href="#">Parkeergarage</a></li> <li id="garageLink"><a href="#">Bij de bakker</a></li> <ul> </nav> The javascript/jquery behind it: $(function () { $("ul").click(function () { // here I want to get the clicked id of the li (e.g. bakkerLink) }); }); How do I do that? Use the .on() method with signature $(common_parent).on(event_name, filter_selector, event_listener) . Demo: http://jsfiddle.net/gLhbA/ $(function() { $("ul").on("click", "li",

Android listselector not visible in custom listview

a 夏天 提交于 2019-12-01 09:11:21
问题 I have made a custom list having image and textview. On setting the styles, the selector is not visible. The style is invoked using setTheme(R.style.rose); in create method of Listactivity as the first call. However if no color is used as background (or background line in style is commented) then the orange selector is visible. But not when the background is listSelector <item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background

Inflate layout on ListItem based on ListItem specific variable

心已入冬 提交于 2019-12-01 04:09:37
I'm using a SimpleCursorAdapter and a ListView to show some data loaded with a Loader. Inside the cursor I have items with a int that goes from 0 to 3. I want the items with this int equals to 0-1 to have a layout (right aligned, one color) and item with 2-3 to have another layout (left aligned, another color). much like a chat app, where sent messages are on the right and received ones are on the left. Is there a simple way to do it? Something like a switch where with 0-1 I inflate layout_1 and 2-3 I inflate layout_2. EDIT: I've added the code of the ListFragment i'm trying to populate. The

Inflate layout on ListItem based on ListItem specific variable

匆匆过客 提交于 2019-12-01 01:12:44
问题 I'm using a SimpleCursorAdapter and a ListView to show some data loaded with a Loader. Inside the cursor I have items with a int that goes from 0 to 3. I want the items with this int equals to 0-1 to have a layout (right aligned, one color) and item with 2-3 to have another layout (left aligned, another color). much like a chat app, where sent messages are on the right and received ones are on the left. Is there a simple way to do it? Something like a switch where with 0-1 I inflate layout_1

Click on list item of a ListView doesn't respond

妖精的绣舞 提交于 2019-11-30 15:12:17
I am implementing ListView in my code. But When I click on the items, it does not respond respond to the click in any way. Could someone help me please? Thanks in advance . Here is the code . public class ListaActivity extends Activity { public final static String EXTRA_MESSAGE = "com.example.provacomunicazione.MESSAGE"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.lsta); Resources res = getResources(); String[] Authors = res.getStringArray(R.array.Lista_Nomi_E_Cognomi_Autori); ArrayList<String> Autori = new ArrayList

Creating a ListView with custom list items programmatically in Android - no xml list item layout

前提是你 提交于 2019-11-30 14:48:49
问题 As I have seen on previously asked questions, inside the custom adapter class (say, MyAdapter extends ArrayAdapter) they always use an inflated xml list-item layout. What I am hoping to do is create everything entirely using Java and no XML... // for example String[] wordlist = new String[] {a, b, c}; LinearLayout list_item_layout = new LinearLayout(this); list_item_layout.setId(5000); TextView listText = new TextView(this); listText.setId(5001); listLayout.addView(listText); ListView list =

Creating a ListView with custom list items programmatically in Android - no xml list item layout

為{幸葍}努か 提交于 2019-11-30 11:47:27
As I have seen on previously asked questions, inside the custom adapter class (say, MyAdapter extends ArrayAdapter) they always use an inflated xml list-item layout. What I am hoping to do is create everything entirely using Java and no XML... // for example String[] wordlist = new String[] {a, b, c}; LinearLayout list_item_layout = new LinearLayout(this); list_item_layout.setId(5000); TextView listText = new TextView(this); listText.setId(5001); listLayout.addView(listText); ListView list = new ListView(this); // ** QUESTION ** do I declare a programmatic .setAdapter() like this? // ** TAKE

Can I use CSS to add a bullet point to any element?

旧巷老猫 提交于 2019-11-30 06:39:54
问题 Pretty simple question, but I am not sure if it is possible. I want to add an image to act as a bullet in all <h1> elements. I know I can achieve this by: <span class='bullet'></span><h1>My H1 text here</h1> with css: .bullet{ background: url('bullet.png') no-repeat; display:inline-block; vertical-align: middle; background-size:100%; height:25px; width:25px; margin-right: 5px; } but is there an automatic way to do the same thing? I was thinking something like: h1{ list-style-image: url(