I am creating a vertical LinearLayout that will be displayed in a vertical ScrollView. I can\'t find a way in Android Studio to see the portion of the LinearLayout that is
Update: Now you can scroll a ScrollView directly inside preview panel (I tested on Android studio version 2.3.2)
Short answer: Right click on your ScrollView and select Refactor > Extract > Layout.
Android-studio will extract your ScrollView into a new layout file and put tools:showIn="@layout/original_layout_file"
attribute at root layout(your ScrollView).
Note: Android-studio will preview full layout if root layout is ScrollView.
The best I found is to set the device to custom. Then we can change the layout simply by dragging.
I might be late but it'll be a lot easier for you to just set the margins to negative to shift the scroll view to the left.
For example:
margin:
left: -100px
Now you can see and edit the scrollview however you like!
You can use scrollY attribute to scroll the ScrollView in the preview. Using scrollY attribute with tools namespace will only scroll the view in the display and not in the actual app. And make sure you use px as the unit with scrollY attribute.
tools:scrollY="150px"
I've just discovered how. You need to create a user defined device definition in Android AVD - I created one that was 480 x 4000 pixels. Exit and restart Android Studio and then you can select this device in the preview renderer and can see 4000 pixels worth of LinearLayout.
Another quick alternative solution is to hide the layouts temporarily at the top so that the layouts at the bottom can appear in the visible window in Android Studio.
Put android:visibility="gone"
on the layouts that you want to hide.
Example:
<HorizontalScrollView
android:visibility="gone"
android:id="@+id/hsv02"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignStart="@+id/ll24"
android:layout_below="@+id/ll199">
</HorizontalScrollView>