2022-10-02 23:06:56 +02:00
|
|
|
package android.widget;
|
|
|
|
|
|
|
|
|
|
import android.content.Context;
|
2023-06-22 11:45:46 +02:00
|
|
|
import android.util.AttributeSet;
|
2024-03-11 18:23:38 +01:00
|
|
|
import android.view.View;
|
2023-06-22 11:45:46 +02:00
|
|
|
import android.view.ViewGroup;
|
2022-10-02 23:06:56 +02:00
|
|
|
|
|
|
|
|
public class ScrollView extends ViewGroup {
|
2023-07-14 18:02:04 +02:00
|
|
|
public ScrollView(Context context, AttributeSet attrs) {
|
|
|
|
|
super(context, attrs);
|
2022-10-02 23:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ScrollView(Context context) {
|
|
|
|
|
super(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2023-08-17 12:59:37 +02:00
|
|
|
protected native long native_constructor(Context context, AttributeSet attrs);
|
2023-09-08 18:28:42 +02:00
|
|
|
@Override
|
|
|
|
|
protected native void native_addView(long widget, long child, int index, LayoutParams params);
|
|
|
|
|
@Override
|
|
|
|
|
protected native void native_removeView(long widget, long child);
|
2022-10-02 23:06:56 +02:00
|
|
|
|
2024-03-11 18:23:38 +01:00
|
|
|
@Override
|
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
|
|
|
|
int width = 0;
|
|
|
|
|
int height = 0;
|
|
|
|
|
if (getChildCount() > 0) {
|
|
|
|
|
View child = getChildAt(0);
|
|
|
|
|
LayoutParams lp = child.getLayoutParams();
|
|
|
|
|
int childWidthMeasureSpec = getChildMeasureSpec(widthMeasureSpec, 0, lp.width);
|
|
|
|
|
int childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
|
|
|
|
|
child.measure(childWidthMeasureSpec, childHeightMeasureSpec);
|
|
|
|
|
width = child.getMeasuredWidth();
|
|
|
|
|
height = child.getMeasuredHeight();
|
|
|
|
|
}
|
|
|
|
|
setMeasuredDimension(resolveSize(width, widthMeasureSpec), resolveSize(height, heightMeasureSpec));
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-02 23:06:56 +02:00
|
|
|
public void setFillViewport(boolean fillViewport) {}
|
|
|
|
|
}
|