I am using custom list view with base adapter. The width of row is longer than screen. But I am not getting horizontal scroll bar like automatic vertical scrollbar. Do I need to specify any extra attribute? I tried with putting listview in horizontal scroll view but still no success. How should I achieve this?
Thanx in advance.
You might just need to use android:layout_width="wrap_content" in your horizontal scroll. You should also show your XML layout in case it is just some other minor change, like having the list view inside the horizontal scroll view.
As a side note, you won't get a horizontal scroll bar but the views inside the horizontal scroll view will slide left/right if their width is wider than the screen.
Related
How could this scrolling behavior be accomplished?
Screenshot
To be specific, I need the wave effect to be shown whenever I try to scroll and reach the limit of a layout. Is there some property that I can tweak?
To get this wave effect, use any horizontally or vertically scrollable view as a container layout in your layout XML.
For example: ScrollView, HorizontalScrollView, NestedScrollView
List and Grid layouts like ListView, RecyclerView also has this scrolling effect.
I'm using a GridView, and I want items in the grid to start from bottom left and grow to top. Any suggestions on how I can achieve that?
I tried using this attribute:
android:stackFromBottom="true"
but it doesn't work! What can be done?
I am not sure about GridView,
but in a GridLayout when you set its orientation to vertical. each new view is added vertically.
row count limits the number of views per column.
I have implemented an Eclipse view. The problem is that when the content is taller than the view height the bottom is depicted and you always have to scroll it up. I'd like to change it programmatically and have the scroll bar positioned at the top.
Is there any way to do that?
I was just wondering if any of you guys could give me a heads up as to what this involves?
I have used ScrollViews, I know they need a LinearLayout to scroll through and that isn't the problem.
It is that there is a dynamic horizontal ScrollView containing several buttons with buttons can be added/removed.
I also have a vertical scrollview.
The GOAL is to set the contents of the vertical ScrollView depending on which button is pressed in the above horizontal ScrolLView.
Any direction/insight would be appreciated.
Cheers
In ur Horizontal scroll view U have to set tag for individual views. Then in on click event of a view u can populate the vertical scroll by required data. I thinks for ur vertical scroll u can use the listview. It will be easy to handle. Also if ur horizontal things are in more numbers then its better to use the ListView for that even..
I'm trying to add a scroll view inside another scroll view.
It should look like is this:
scroll view
linear layout
myprogramaticscroll view
myprogramticlinear layout
myprogramticbutton
end button
end layout
end scroll
end linear
end scroll
I'm trying to add scroll views inside of that. It goes in there, but I need to know how to set parameters correctly so I can see the whole button I have inside of my scroll view. I only see part of it, and I need to set the programatic linear layout and scroll view's width height and id. How do I do this? This is what I have so far:
//the layout I'm putting my scrollview/linearlayout/button in
LinearLayout l = (LinearLayout) findViewById(R.id.linearLayoutFavorites);
ScrollView scroll = new ScrollView(this);
LinearLayout nl = new LinearLayout(this);
ImageButton yourButton = new ImageButton(this);
nl.addView(yourButton);
scroll.addView(nl);
l.addView(scroll);
You CAN'T put a scroll view inside another scroll view, that behavior would be odd, and Android would not know how to handle your scroll on the views.
For setting layout parameters, take a look at ViewGroup.LayoutParams, there're actually quite a few subclasses of ViewGroup.LayoutParams, which are for setting layout parameters for different kinds of layouts.
You can use a Scrollview in an another Scrollview. But this is not suggestible. It will be an issue to both the user and android OS. It will leads to Memory issues and also touch issues while scrolling the views. If you are expecting the Two scrolls (Horizontal and Vertical) at a time, then it is preferble to go for TwoDSCrollView
If you want to set the Layoutparams you should look at ViewGroup.LayoutParams.
If you want to set width and height then no need to set the Layoutparams. You can get the existing params by using getLayoutParams() for the view and set width and height to that params.
If you want to place vertical in vertical scroll or horizontal in horizontal scrollview the you should set the height of the internal scrollview height to the actual height of the total childs.