-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: QMUIDialog built by MessageDialogBuilder should scroll when t…
…he message is long #114
- Loading branch information
Showing
5 changed files
with
125 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
qmui/src/main/java/com/qmuiteam/qmui/widget/QMUIWrapContentScrollView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package com.qmuiteam.qmui.widget; | ||
|
||
import android.content.Context; | ||
import android.util.AttributeSet; | ||
|
||
/** | ||
* height is wrapContent but limited by maxHeight | ||
* <p> | ||
* Created by cgspine on 2017/12/21. | ||
*/ | ||
|
||
public class QMUIWrapContentScrollView extends QMUIObservableScrollView { | ||
private int mMaxHeight = Integer.MAX_VALUE >> 2; | ||
|
||
public QMUIWrapContentScrollView(Context context) { | ||
super(context); | ||
} | ||
|
||
public QMUIWrapContentScrollView(Context context, int maxHeight) { | ||
super(context); | ||
mMaxHeight = maxHeight; | ||
} | ||
|
||
public QMUIWrapContentScrollView(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public QMUIWrapContentScrollView(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
public void setMaxHeight(int maxHeight) { | ||
if (mMaxHeight != maxHeight) { | ||
mMaxHeight = maxHeight; | ||
requestLayout(); | ||
} | ||
} | ||
|
||
@Override | ||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
int expandSpec = MeasureSpec.makeMeasureSpec(mMaxHeight, | ||
MeasureSpec.AT_MOST); | ||
super.onMeasure(widthMeasureSpec, expandSpec); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters