Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 1 addition & 27 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,262 changes: 14 additions & 2,248 deletions .idea/workspace.xml

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions app/src/main/java/com/wangjie/wheelview/WheelView.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ public void startScrollerTask() {
private void initData() {
displayItemCount = offset * 2 + 1;

views.removeAllViews();
for (String item : items) {
views.addView(createView(item));
}
Expand All @@ -193,7 +194,8 @@ private TextView createView(String item) {
if (0 == itemHeight) {
itemHeight = getViewMeasuredHeight(tv);
Log.d(TAG, "itemHeight: " + itemHeight);
views.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, itemHeight * displayItemCount));
views.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, itemHeight * displayItemCount,Gravity.CENTER_HORIZONTAL));
views.setGravity(Gravity.CENTER);
LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) this.getLayoutParams();
this.setLayoutParams(new LinearLayout.LayoutParams(lp.width, itemHeight * displayItemCount));
}
Expand Down Expand Up @@ -314,7 +316,8 @@ private int[] obtainSelectedAreaBorder() {
public void setBackgroundDrawable(Drawable background) {

if (viewWidth == 0) {
viewWidth = ((Activity) context).getWindowManager().getDefaultDisplay().getWidth();
// viewWidth = ((Activity) context).getWindowManager().getDefaultDisplay().getWidth();
viewWidth=views.getWidth();
Log.d(TAG, "viewWidth: " + viewWidth);
}

Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Apr 10 15:27:10 PDT 2013
#Thu Jul 14 13:03:03 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip
5 changes: 3 additions & 2 deletions local.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
## This file is automatically generated by Android Studio.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file should *NOT* be checked into Version Control Systems,
# This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/Users/wangjie/work/java/android/sdk
#Thu Jul 14 13:02:39 CST 2016
sdk.dir=D\:\\sdk