android-listview

How to Change List View Text color

怎甘沉沦 提交于 2019-12-09 13:11:26
问题 In my application I want to change the list view text color. In this case I am using XML file for list view. Is it possible? If yes then give the example. gender.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:background="@drawable/topelg" > <ListView android:id="@+id/android:list" android:layout_marginTop="60dip"

How to set a simple adapter to listview?

人盡茶涼 提交于 2019-12-09 12:31:18
问题 I have problem adding arraylist to list view, will explain about my problem here.. tell me what is wrong here... I have three linear layouts, and in the middle layout i have list view, as shown in the xml file below.. ` <LinearLayout android:id="@+id/linearLayout1" android:layout_width="match_parent" android:layout_height="wrap_content" > <Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> <ImageView android:id="@

How to add dividers between disabled items in ListView? - Lollipop

微笑、不失礼 提交于 2019-12-09 12:22:06
问题 To add the dividers between disabled items (not clickable) in ListView for Android previous to Lollipop I override adapter's method areAllItemsEnabled() to return true. But now in Lollipop this method doesn't fix the problem. The dividers are invisible in ExpandableListView too. Is there a way to fix this problem without adding the divider in my item layout? 回答1: We ended up adding two Views of 1dp to fake the divider and checking on version to set Visibility. The problem is worse. We also

I can't click the ListView in android?

拟墨画扇 提交于 2019-12-09 11:32:54
问题 I made an app using contact sync. I list the following contact info with photo, name and number. I successfully list all those things in a custom ListView , but I can't click the ListView . It looks like locked, Unable to click it. But I made a same procedure to another activity. Using custom ListView but I can click this view and it works fine. What is the problem? here is my sample coding: ListView settingsList = (ListView) findViewById(R.id.manage_track_listView); ArrayList<ContactList>

ListView doesnt fire setOnLongClickListener, only setOnItemClickListener

只愿长相守 提交于 2019-12-09 10:45:19
问题 I'd like to have both type of clicks on a listView - onClick and LongClick. I've implemented it like this: this.listViewSub = (ListView) this.findViewById(R.id.listsub); this.listViewSub.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(final AdapterView parent, final View view, final int position, final long id) { ... } }); // listen to long click - to share texts this.listViewSub.setOnLongClickListener(new OnLongClickListener() { @Override public boolean

Context menu from a ListFragment

我是研究僧i 提交于 2019-12-09 09:55:17
问题 I am trying to create an application for tablets that has a main screen with three fragments, each containing a list. I would like to enable context menus for each list, but whenever I attempt that I get an unexpected program stop and Force Close. Following is the relevant code and xml that works and gives me my desired three fragments with listviews in each, before I try and add the context menu: main.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas

Get the total count of number of rows in the Custom Listview Android

喜夏-厌秋 提交于 2019-12-09 08:04:19
I am trying to getting the total Count of the getView custom listview. But want to display in the different layout. Here is my onCreatedView. I am not sure how to inflate the layout. Thanks for all your help. private static ListView addDropListView = null; private TransactionAddDropAdapter addDropAdapter = null; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { fragmentPendingTrades = inflater.inflate(R.layout.fragment_transactions_pending, container, false); pendingTradesView = inflater; return fragmentPendingTrades; } public void

Android + ListFragment with a custom view hierarchy

最后都变了- 提交于 2019-12-09 08:03:04
问题 I'm attempting to customize the fragment layout by returning my own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle) . This inflates my custom view, but seems to stack the views instead of inflating within, I see everything at once. Any help is appreciated. MyActivity.java: public class MyActivity extends FragmentActivity{ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getSupportFragmentManager().findFragmentById(android

How to handle fragments saving state within ViewPager that's inside a NavigationDrawer fragment?

半城伤御伤魂 提交于 2019-12-09 07:16:12
问题 Background I have the next scenario: There is a navigation drawer with items. each switches to a different fragment. One of the fragments holds a viewPager, which holds fragments. Each of the viewPager's fragments have a ListView in it. When the user switches between the pages of the viewPager, or goes to another navigation-drawer fragment, and then back to one of the viewPager's fragment, the ListView should be restored to its original state. All that I've used is via the support library.

ListView in Fragment in ViewPager in ScrollView for android >=2.3

冷暖自知 提交于 2019-12-09 06:57:05
问题 Is it possible to do it? The main point are: A Complex header out of the listView but that must scroll A ListView whose scroll is handled by the far ScrollView parent. The ListView must have recyling, so the linearLayout cannot be a solution Thanks 回答1: to directly answer the question: Is it possible to do it? Yes it is. You can see this example here in the Albums and Profiles sections. But it's not simple, nor straight forward. There're two issues in adding a ListView inside a ScrollView