android-listfragment

ListFragment multi-choice does not show selection

本秂侑毒 提交于 2019-12-06 08:28:09
I'm trying to implement the contextual action bar in my app. I'm extending a ListFragment and I have a custom ArrayAdapter and list item xml defined. Clicking on items works fine and the background color changes on the list item. Where I'm running into trouble is when selecting multiple items. The contextual action bar comes up and I can tell I'm actually selecting items when I touch them because I'm having it log which items are selected, but the background highlight color on the list item does not change! It seems like some other people were running into this problem when using the Fragments

ListFragment gives ListView whose id attribute is 'android.R.id.list'

穿精又带淫゛_ 提交于 2019-12-06 08:03:17
问题 I'm trying to implement a simple list/detail view as in figure 1 here but I'm getting a "Your content must have a ListView whose id attribute is 'android.R.id.list'" runtime exception. This error seems to have been discussed at length if the amount of results is anything to go by, but most of the answers seem to be about extending ListActivity whereas I'm extending ListFragment. So far I've had no luck in getting it fixed. The base activity is: SpeciesListActivity.java public class

Android Ribbon menu using fragments

让人想犯罪 __ 提交于 2019-12-06 05:31:20
问题 I did a coding for ribbon menu using horizontal scrollview. my code is given below: public class HorzScrollWithListMenuActivity extends Activity { MyHorizontalScrollView scrollView; View menu; View app; ImageView btnSlide; boolean menuOut = false; Handler handler = new Handler(); int btnWidth; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflater = LayoutInflater.from(HorzScrollWithListMenuActivity.this); scrollView =

ListView Requires 2 setSelection's to Scroll to Item

强颜欢笑 提交于 2019-12-06 04:28:47
Peculiar problem I'm having with a cursoradapter in a listfragment. In my onLoadFinished I select the previously selected item in order to scroll the listview to the previous position (and then highlight that item). This works splendidly, except for the scrolling part. If I just use one post and delay it (even say 5 seconds), the item gets selected but the list will not scroll (the selected item may out of view at this time) With or without delay same behavior with just one post. I have to post setSelection AGAIN to get the listview to scroll so the selected item is in view. It doesn't matter

Putting a Textview on top of a List Fragment

橙三吉。 提交于 2019-12-06 04:07:15
问题 How Can I add a textview on top of a fragment. I'm using the following adapter to populate the listfragment and the xml file is each row in the list fragment. I need to add a textview ontop of listview which must be scrollable along with the list? public class Adapter extends BaseAdapter { Context context; public TextView txtName; public TextView txtTitle; private LayoutInflater mInflater; private Storage storage; FontManager fontManager; Typeface typeface; public Adapter(Context _context

Hiding/showing the contextual action bar programmatically

烈酒焚心 提交于 2019-12-06 02:38:20
问题 My use case: I have an activity with a ViewPager as its only view element, set up with three Fragment s for its three pages (using a FragmentPagerAdapter ). One of these fragments is a ListFragment , while the other two regular Fragment s containing some infographics. The list in the ListFragment allows "checking" elements, and checking elements brings up the contextual action bar, presenting a list of actions possible on the selected/checked items. My problem: When I select a couple of list

How to set color of selected item in ListFragment in android?

五迷三道 提交于 2019-12-05 21:49:27
I have a listview in ListFragment which gets populated from an adapter, I want to highlight the clicked (or selected) item in the list as well as do some action based on the selection. I am able to handle the event but How do I set the color of selected item from the list. Ian If you're using a ListFragment then you might not be specifying a ListView in XML which means you'll need to set the listSelector in code. Be careful not to set it too early in the activity life-cycle though as you'll end up with an IllegalStateException . level_list_selector.xml <?xml version="1.0" encoding="utf-8"?>

Display Album and Artist in listview with LoaderManager and CursorLoader

妖精的绣舞 提交于 2019-12-05 19:34:44
I have a ListFragment whose list should diplay the Albums of the device and the associated artist using MediaStore . Each row has thus two TextViews . I'm using LoaderManager and CursorLoader to fill the list up, with a custom CursorAdapter in order to bind the TextViews of the row to the data. ListFragment Code : public class AlbumsFragment extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> { AlbumsAdapter mAdapter; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View myFragmentView = inflater.inflate(R.layout

ListView shows empty message briefly before data is loaded

让人想犯罪 __ 提交于 2019-12-05 01:58:25
I've created a ListFragment using the following custom layout which adds a TextView to show a message when the list is empty: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <ListView android:id="@id/android:list" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:drawSelectorOnTop="false"/> <TextView android:id="@id/android:empty" android:layout_width="match_parent" android

ListView setOnItemClickListener in ListFragment not working

随声附和 提交于 2019-12-04 23:27:20
I am developing an app that uses ActionBar tabs to display a list of options through ListFragment. The list (and ListFragment) display without a problem, but the ListView's setOnItemClickListener doesn't seems to work, as nothing happens when an item in the list is clicked. Here's the code for the ListFragment class: package XXX.XXX; public class AboutFrag extends SherlockListFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.aboutfrag, container, false); ListView lv = (ListView) view