I have a long Screen, and i set ScrollView, but in Preview screen in Android Studio i do not see part of the Screen. How i can see it?
I found another & pretty cool solution. It's not about size of the layout in preview. You can simulate scrolling instead, to see the hidden content.
Use with tools, as it has influence only in preview. Then increase/decrease value for "scroll".
<YourRootViewOfAnyType
xmlns:tools="http://schemas.android.com/tools"
...
tools:layout_marginTop="-200dp"
...
>
</YourRootViewOfAnyType>
Here's The Magic Solution :
Click on the highlighted button to increase the size of the preview window. Note : You can increase the size to any desired size!
Then use the zoom button to zoom and see the preview.
Here's how it will look then.
To get the scroll Bar in application ....
Use scroll view as the root view in your .xml file and then make the nesting of layouts.
If you don't want the scrolling image to fade away in app then add the code under ScrollView :
android:fadeScrollbars="false"
If you put your layouts in a ScrollView it should automatically (at least in Android Studio) show you everything.
Another workaround is to make a new AVD with a big resolution, something like 4000px height, and use that for preview, worked for me :)
更新您的 android studio 现在您可以在滚动时看到预览。
As Verdan answered, you should use a ScrollView.
But the trick is that the ScrollView must be your root layout (at least temporary).
So just wrap all your layout into a ScrollView (even though you have another nested one or a ListView).
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- PUT All YOUR STUFF HERE -->
</ScrollView>
Then you will see all your layout in the preview.
And when your are done you can just remove it
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.