RecyclerView – How to smooth scroll to top of item on a certain position?

RecyclerView is designed to be extensible, so there is no need to subclass the LayoutManager (as droidev suggested) just to perform the scrolling. Instead, just create a SmoothScroller with the preference SNAP_TO_START: RecyclerView.SmoothScroller smoothScroller = new LinearSmoothScroller(context) { @Override protected int getVerticalSnapPreference() { return LinearSmoothScroller.SNAP_TO_START; } }; Now you set the position where you want … Read more

Unable to position pager (navigation bar) above jqGrid

You should use toppager:true jqGrid option instead. You don’t need define <div id=”pager”></div> and use pager: ‘#pager’ parameter. The id of the pager from the top of jqGrid will be “list_toppager” (id of the table element appended with “_toppager”). If you want to add navigator you can use $(“#list”).jqGrid(‘navGrid’,’#list_toppager’); If you use define <div id=”pager”></div> … Read more

Position: absolute and parent height?

If I understand what you’re trying to do correctly, then I don’t think this is possible with CSS while keeping the children absolutely positioned. Absolutely positioned elements are completely removed from the document flow, and thus their dimensions cannot alter the dimensions of their parents. If you really had to achieve this affect while keeping … Read more

Position element fixed vertically, absolute horizontally

Position Fixed Element Horizontally Based Off Another Element (Disclaimer Note: The solution offered here is not technically “absolute horizontally” as the question title stated, but did achieve what the OP originally wanted, the fixed position element to be ‘X’ distance from the right edge of another but fixed in its vertical scroll.) I love these … Read more

How to set iPhone UIView z index?

You can use the zPosition property of the view’s layer (it’s a CALayer object) to change the z-index of the view. theView.layer.zPosition = 1; As Viktor Nordling added, “big values are on top. You can use any values you want, including negative values.” The default value is 0. You need to import the QuartzCore framework … Read more

Set the absolute position of a view

You can use RelativeLayout. Let’s say you wanted a 30×40 ImageView at position (50,60) inside your layout. Somewhere in your activity: // Some existing RelativeLayout from your layout xml RelativeLayout rl = (RelativeLayout) findViewById(R.id.my_relative_layout); ImageView iv = new ImageView(this); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(30, 40); params.leftMargin = 50; params.topMargin = 60; rl.addView(iv, params); More examples: … Read more