LinearLayout with Fragment inside PopupWindow - android

I am using a PopupWindow to overlay a ViewPager with 5 different Fragments over users IME if he clicks on a specific button. As far as i know at the moment, it is not possible to use a Frgament as content of a PopupWindow. So my question is: Is it possible to put the Fragment with the ViewPager inside a LinearLayout(for example) and set the LinearLayout as Content of the PopupWindow? And if not, why does it not work if i use the getView() - method of my Fragment to get a view which i can set as content of the PopupWindow
Any help would be much appreciated!

No answer for 7 days gave me the possibility to figure it out by myself. As far as I know there is no way to do this, the layout which is the content of the fragment has to be inflated into the popupwindow. I tried it out and it works this way...

Related

How to connect the Buttons UI?

I struck in Materiel Design and need to connect those two button like the image mentioned below and when i clicked the any one button only the layout should change not the activity, so I googled for this solution but i didn't found any.Could anyone suggest me some possible solutions to achieve this UI.
You want to keep the 2 buttons and a line in buttons as well if that is the case.
Use 2 buttons widgets and keep a view between them as for lining purpose. And fro your question one button only the layout should change not the activity
You can try fragments. On clicking any of the buttons change fragment
you are suppose to use Fragment with viewpager!
you just disable viewpager swipe by this mViewPager.setPagingEnabled(false);
and setSelection when clicked on item
here is a cool library to implement this.Step view

Show/hide a layout on scroll up/down android

I am working on an android application and want to implement a functionality in which I want to show a layout which will contain Like/Comment of that content at the bottom of the page.
I want this layout to be shown when I scroll up the page and hide when I scroll down the page.
I have scene many applications that have implemented this feature, but I have no idea how to implement this feature in my app.
Please check this link of the app which is giving the same functionality which I want to implenment https://play.google.com/store/apps/details?id=com.midsizemango.materialapps
Please help if anyone have idea here, Thanks a lot in advanced.
You need to do the same thing which happens with fab, first create a class extendingCoordinatorLayout.Behavior<View> and implement it like other fab examples. just remember that it won't work on simple listView and gridView.
Also here's a good detailed tutorial for you.
You Just have to set Scroll-Up & Scroll-Down listener of your Recycler view or Scroll View check Reference link.
Now base on Scroll-Up & Scroll-Down listener set VISIBLE / GONEof your footer view either it is LinearLayout or Toolbar with animation.

float listview ontop of an activity

How to get floating listview on top of another activity like in android facebook app.I tried to do it but I dont know how to proceed .
I am trying to create listview with toggle imagebutton on top which displays listview with linear fade down animation over already existing view .Here is a link to what I am talking about
(source: handytechplus.com)
Rally appreciate any help or seek clarity in the above question.
Thanks in Advance.
My suggestion would be using a custom ListFragment, sitting on top of your data.
As RelativeLayout works, the lower the item is in your xml, the higher its Z-axis will be.
Create a new class extending ListFragment, put it in the XML.
when you want the layout closed, just set the visibility of the View (Fragment) to "gone" and vise-versa.
About the animation, check the Android developer site about changing visibility animation.
EDIT:
About creating Fragment and implementing in the XML : http://developer.android.com/training/basics/fragments/creating.html
To change visibility :
((CustomFragment)getSupportFragmentManager().findFragmentById(R.id.your_fragment)).setVisibility(View.GONE);
Make sure you use FragmentActivity as your activity and support4.ListFragment instead of the regular ListFragment.

Nested text view in android,with dynamic content

I want to display a recursive or nested text view at depth of 3 in Android.The text to be displayed is, dynamic coming from web service.
for example:
If I Click on Help(Level 1)
it'll show topics under Help
If I Click on Help_Topic_1(Level 2)
it'll show questions under Help_Topic_1
If I click on this question, say HT_Question_1(Level 3)
it'll show Answer of that question(Level 3)
how to accomplish with this? please guide me.
You should use ExpandableListView. Reference http://developer.android.com/reference/android/widget/ExpandableListView.html
You can call expandGroup and collapseGroup methods for expanding and collapsing on clicks.
the simplest way to do this is to have a nested layout structure. Your root view will contain the button to show level 1 and a child layout and initially be visible. The children's layout visibility will initially be set to "GONE". In the onclick listener for each button you change the visibility of the layout below it to view to "VISIBLE".
This of course is a very simple way of doing it. If you require to have open and close animations you'll need to use a more complex method.

SimpleCursorAdapter within a ScrollView

I'm having abit of an issue and i'm not too sure how to go about solving it.
Essentially i have an activity which has a base xml layout of ScrollView and i want this activity to list some results from a Cursor. So i thought i'd use SimpleCursorAdapter... however when i got it all set up it appears that the ListView that the SimpleCursorAdapter goes into doesn't play nice being within another scrollable layout element.
I've sorta got it working programmically but i'd much rather use a ListAdapter as it will make each list entry look like a button and keep it inline with the design of the rest of the application and can handle the ids of each item and where to send the user upon clicking.
So my question is this: is there anyway to either make ListView show all the items such that it never needs to scroll, or can i change the ListView to something like a LinearLayout?
I hope that makes sense!
Any help / insight / ideas are welcome!
Cheers!
You can NEVER use a scroll view and a ListView together. Its a mess! and illogical as well.
Here are some of the approaches you can use:
Theres no screen big enough to show all the content of you listView you can try wrapping up your content but as I said it won't help as scroll view and list view don't work together. So you can either remove your or
If your list items are simple you can dynamically add your views to LinearLayout with specified location
Another tip I can give you is you can always use an relative layout and place your listView alignParentBottom="true" and emit the scrollView approach this will make you listview alwyas scrollable.
It doesn't really make sense to have a ListView inside a ScrollView at all. The ListView implements it's own scroll function so it should not be used in conjunction with a ScrollView anyway.
You should rethink your UI design.
I agree with Shardul; trying to put a listview with a scrollview will make it impossible to scroll. Have a look at the links below to see what you can accomplish with just a ListView -
a.
custom backgrounds info.
custom adapters

Categories

Resources