android-listfragment

Set TouchListener to root view without overriding touchevents of child view?

廉价感情. 提交于 2019-12-04 06:01:35
问题 My Activity consists of one Framelayout (named fragment_content) where I replace/add different Fragments. Now I set a TouchListener to this fragment_content to implement a "Two-Finger-Swipe" (-> just a swipe motion with two fingers). The Problem I have is that as soon my Fragment extends from a ListFragment the TouchListener of fragment_content will be ignored. I know I can set a touchlistener to the listview, but than I have to implement the listview settings (-> scrolling, listItemClick).

List View in Fragment not working

荒凉一梦 提交于 2019-12-04 05:22:26
问题 Heres my fragment code : public class LeftFragment extends ListFragment { ArrayList<String> data; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.left_fragment, container, false); data = new ArrayList<String>(); data.add("1. dell"); data.add("2. samsung"); data.add("3. apple"); data.add("4. hp"); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,

findViewById not recognised in ListFragment [duplicate]

寵の児 提交于 2019-12-04 02:25:56
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: findViewById in fragment android I am currently working on android project and trying to get fragments working. The fragment part is working but I'm trying to control UI components, on a standard activity I can use something like TextView txtMyTextBox = (TextView)findViewById(R.id.my_text_box) I am extending the class by ListFragment but when why I try the same code as above I get the following error The method

Android, How to mix ActionBar.Tab + View Pager + ListFragment

痞子三分冷 提交于 2019-12-03 17:30:39
I've been trying to test how to mix all these things together and I'm having problems!! I just want an app with three tabs using the ActionBar.Tab. For example, this tabs can be movies genres Action, Adventure and Animation, the user can swipe through the tabs, so it will use the ViewPager and each tab will show a list of movies of that genre. There's no need to have three different fragments classes because all tabs will be the same format a simple list. And I'm having problems because when I select the second tab, the position for onPageSelected is 1, mViewPager = (ViewPager) findViewById(R

Using Contextual action bar with fragments

偶尔善良 提交于 2019-12-03 16:29:32
问题 I am currently working on android project and making use of fragments and ListViews/ListFragments. I have contextual action bars working on standard activities such as a ListActivity. Now I am trying to do the same sort of thing but on a fragment layout. I have a MainActivity which extends Activity which inflates the XML for the layout that contains the 2 fragments, fragment A and fragment B. Fragment A extends ListFragment and contains a ListView which is populated from data within an SQLite

Using Contextual action bar with fragments

。_饼干妹妹 提交于 2019-12-03 05:37:24
I am currently working on android project and making use of fragments and ListViews/ListFragments. I have contextual action bars working on standard activities such as a ListActivity. Now I am trying to do the same sort of thing but on a fragment layout. I have a MainActivity which extends Activity which inflates the XML for the layout that contains the 2 fragments, fragment A and fragment B. Fragment A extends ListFragment and contains a ListView which is populated from data within an SQLite Database. When I have got a contextual action bar working on a standard ListActivity I have a class

ListFragment onItemClickListener not working

拟墨画扇 提交于 2019-12-03 05:20:18
I'm using the tabbed layout (with swipe). Here I have 3 tabs with controlled by a SectionsPagerAdapter. Each tab is a ListFragment. Now I want to get an event fired when one of the items in the list is clicked. I would like a listener for each tab. Here's the code now (Which isn't working, event is not fired). public class NyhederFragment extends ListFragment { public static final String ARG_SECTION_NUMBER = "section_number"; private static final String TAG="NyhederFragment"; private List<Item> newsItems; private ArrayList newsHeadlines; private ArrayAdapter adapter; private BroadcastReceiver

Custom ArrayAdapter in a ListFragment

主宰稳场 提交于 2019-12-02 22:32:02
I'm trying to create a custom ArrayAdapter to use for my ListFragment . Right now nothing is being displayed in the ListFragment except for the TextView saying what Fragment number it is. I have put a breakpoint in getView() method of my adapter and it is not being called. I searched for reasons that wouldn't be called and some people seem to think that my ListView is hidden, so I've tried changing the layout_height to wrap_content , but that didn't work. Also, I've been following the code from this developer's page: http://developer.android.com/reference/android/support/v4/app

List fragment not appearing owing to No view found for ID error

跟風遠走 提交于 2019-12-02 19:09:37
问题 I'm trying to launch a list fragment but it only seems to be working on tablets. When I run my app on phones the app crashes. Does anyone know how to resolve this issue? Code are below. Error Caused by: java.lang.IllegalArgumentException: No view found for id 0x7f0c0050 (com.apptacularapps.exitsexpertlondonlite:id/master_container) for fragment FragmentMainList{b76424 #1 id=0x7f0c0050} MainActivity.java public class MainActivity extends ActionBarActivity { private boolean mTwoPane; @Override

Shadow Separator Between Android Fragments

最后都变了- 提交于 2019-12-02 13:54:38
I have a layout similar to the ICS Gmail app for tablets ( ListFragment on the left and content on the right) and I was wondering how I could go about constructing the layouts such that there is a shadow separator between the two fragments (like in the Gmail app, shown below) . Also, as this is applicable to this question, how can I have that nice triangle/arrow marker in the active list item's layout? I assume to implement this, the ListView itself must lie above the shadow "layer", but I have no idea how to create that. Just to let everyone know (because there seems to be a lack of