float listview ontop of an activity - android

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.

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.

How to change gridview layout correctly while scrolling in android

I have a gridview in my android project which show some Items that fetch from. I use a custom adapter extends BaseAdapter and a custom layout for my gridview to show each item.
What I need is to change the gridview custom layout when a button click, I use a FloatingActionButton that when I click on that the layout change correctly, but the problem is when I am scrolling the gridview and click the FAB the gridview layout change but it render incorrectly !!!
What should I do to change layout correctly? Is there anyway to stop gridview from scrolling then change the layout?
P.S: I've used gridview.invalidate() method and some other methods like this but nothing works ! I also should mention that when the layout render incorrectly when I scroll up and down it became correct !
This should be very possible and easy using android's recycle view with it's layout manager. check up on their documentation https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html

LinearLayout with Fragment inside PopupWindow

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...

Android: TranslateAnimation for layout when soft keyboard is shown

I found this code to make a sliding menu like facebook app. He (who wrote this code) used a FrameLayout to contain 2 views and used TranslateAnimation to show/hide menu. He used setFillAfter(true) to keep position of view. In onAnimationEnd, he used view.layout(left, top, right, bottom) to ensure that views are in correct position.
I modified this code to use with 3 views: leftView, centerView and rightView (Each view in my case is a LinearLayout) like facebook and found a problem: when activity is show leftView (and a part of centerView), if I click an EditText in leftView and soft keyboard is shown, it return to centerView. Similarly, it happens when I click on an ExpandableListView and Childs is shown.
Can anyone help me please?‎. Here is [my code](https://dl.dropbox.com/u/38205395/TestErrorSlidingActivity.rar).
Thank you in advance and sorry for my poor English!
Your problem is that the keyboard retriggers the measurement/layout pass of your FrameLayout.
At this point the layout you manually called gets replaced from the FrameLayout original layout.
To avoid this you have 2 ways:
1) Do not use a FrameLayout (define your own extension of the viewgroup or extend FrameLayout overriding all the methods regarding the measurement/layout of the children)
2) Do not call layout after the animation but rather try using setMargin on your children (if possible)
Obviously the best way would be the first one.
Try using android:windowSoftInputMode="adjustNothing" for activity in manifest.
Worked for me :)

Categories

Resources