Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6649159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:44:27+00:00 2026-05-26T00:44:27+00:00

I have a custom View that is nested inside ScrollView and HorizontalScrollView like this:

  • 0

I have a custom View that is nested inside ScrollView and HorizontalScrollView like this:

<HorizontalScrollView>
    <ScrollView>
        <GameView>
        </GameView>
    </ScrollView>
</HorizontalScrollView>

I want to change the GameView size depending on user action (zooming in or out) but when I try to do

gameView.setLayoutParams(new LayoutParams((int)(gameView.BOARD_WIDTH * gameView.STEP), (int)(gameView.BOARD_HEIGHT * gameView.STEP)));

I get an exception:

java.lang.ClassCastException: android.view.ViewGroup$LayoutParams

at android.widget.ScrollView.measureChildWithMargins(ScrollView.java:1066)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.widget.ScrollView.onMeasure(ScrollView.java:296)
at android.view.View.measure(View.java:8313)
android.widget.HorizontalScrollView.measureChildWithMargins(HorizontalScrollView.java:1075)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.widget.HorizontalScrollView.onMeasure(HorizontalScrollView.java:302)
at android.view.View.measure(View.java:8313)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:581)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:365)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3138)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:250)
at android.view.View.measure(View.java:8313)
at android.view.ViewRoot.performTraversals(ViewRoot.java:839)
at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3683)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

Is there a way of changing the size of the gameView?

Edit: I have solved the issue, the anwser was:

gameView.setLayoutParams(new ScrollView.LayoutParams((int)(BOARD_WIDTH * STEP), (int)(BOARD_HEIGHT * STEP)));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T00:44:27+00:00Added an answer on May 26, 2026 at 12:44 am

    I have solved the issue, the solution was using LayoutParams of the parent View:

    gameView.setLayoutParams(new ScrollView.LayoutParams((int)(BOARD_WIDTH * STEP), (int)(BOARD_HEIGHT * STEP)));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have custom view in a HorizontalScrollView wrapped in a ScrollView and I want
I have a custom-made view that extends the View class. I would like 2
I have a view that I want to add some custom drawing to. I
I have a custom View that I'd like to specify the layout of in
I have created one custom view that contains the horizontalscrollview. Now when i changes
I have created one custom view that contains the horizontalscrollview. Now when i changes
We have used Custom List View inside that one Text View and two Edit
If I have a custom view controller class that I want to reuse but
I have a custom view that I would like to create from a resource
I have a custom control/view that observes the direction of a gesture within its

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.