Comments (2)
The code is Same what it has in horizontalList. Problem here is Horizontal
list has no effect on wrap_content as it takes match parent
On Tue, May 13, 2014 at 11:10 PM, Troy Locke [email protected]:
Could you send some sample code. Or post your layout here.
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/43#issuecomment-42985540
.
from devsmartlib-android.
Managed to make it work, now the content width is set to wrap_content and you can give gravity to your parent layout.
Add this function to the component class file.
public void resetPosition() {
if (mContext != null && mAdapter != null) {
DisplayMetrics metrics = mContext.getResources()
.getDisplayMetrics();
int width = metrics.widthPixels;
if (mAdapter.getCount() * mChildWidth > 0
&& mAdapter.getCount() * mChildWidth < width) {
Log.e("child width", "child: " + mAdapter.getCount()
+ ": width:" + mChildWidth + "");
setLayoutParams(new LinearLayout.LayoutParams(
mAdapter.getCount() * mChildWidth, 300));
}
}
}
After you set the adapter/notifydatasetchanged
call the function like
yourHorizontalListView.post(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
yourHorizontalListView.resetPosition();
}
});
Worked in my case.
from devsmartlib-android.
Related Issues (20)
- HorizontalListView: scrollTo last items HOT 13
- can you add the ability to be notified when the list reaches the beginning or end? HOT 2
- Optional center-lock feature HOT 1
- getFirstVisiblePosition returns 0 HOT 1
- Please implement smoothScrollToPosition(int position)
- HorizontalListView item width incurrent when scroll again and again. and solution.
- Horizontal ListView alternative
- Unable to find class error
- How to let horizontal listview could be use “setSelection” (I want the listview comes out in the middle position) HOT 9
- Listview flickers when list view item has clickable item and has click listner??
- Cannot build library in eclipse HOT 2
- No default press and click effect
- Should add support for Gradle and Maven.
- Importing library to Android Studio HOT 1
- How I can make default scroll to the last item in the ListView? HOT 2
- Link for new repo not working
- 左右多滑动几次,item排列就乱了
- Scroll to last position
- Fast Scroll Problem in HorizontalListView
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devsmartlib-android.