Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. <NestedScrollView>
  2. <LinearLayout>
  3. <LinearLayout></LinearLayout>
  4. ... // About 3 of the LinearLayouts
  5. <ExpandableListView/>
  6. </LinearLayout>
  7. </NestedScrollView>
  8.  
  9. @Override
  10. public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  11. int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
  12. Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
  13. super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
  14. ViewGroup.LayoutParams params = getLayoutParams();
  15. params.height = getMeasuredHeight();
  16. }
  17.  
  18. public class NonScrollExpandableListView extends ExpandableListView {
  19.  
  20. public NonScrollExpandableListView(Context context) {
  21. super(context);
  22. }
  23.  
  24. public NonScrollExpandableListView(Context context, AttributeSet attrs) {
  25. super(context, attrs);
  26. }
  27.  
  28. public NonScrollExpandableListView(Context context, AttributeSet attrs, int defStyle) {
  29. super(context, attrs, defStyle);
  30. }
  31.  
  32. @Override
  33. public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  34. int heightMeasureSpec_custom = MeasureSpec.makeMeasureSpec(
  35. Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
  36. super.onMeasure(widthMeasureSpec, heightMeasureSpec_custom);
  37. ViewGroup.LayoutParams params = getLayoutParams();
  38. params.height = getMeasuredHeight();
  39. }
  40. }
  41.  
  42. <com.example.extraclasses.NonScrollExpandableListView
  43.  
  44. android:layout_width="match_parent"
  45. android:layout_height="wrap_content" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement