ntgCleaner
ntgCleaner

Reputation: 5985

Android Studio: View content in scrollView that is off the screen

I'm brand new to android development and I'm using both design view and text view to create a layout.

I've just used a scrollView element on the screen and have started to fill in all of the content. Unfortunately, the content is going off of the page (obviously will be scrollable when it's built). But I would like to be able to see the designed content before I run a build to see it.

Is there any way to expand my view of the scrollView element so I can see the content below the screen?

Upvotes: 2

Views: 2056

Answers (2)

QuantumTiger
QuantumTiger

Reputation: 998

If you put all of the content you want in a separate layout using merge tag as the top level element you should be able to preview that layout in the preview window. Then just use an include tag to put it into the scrollView

eg

<merge xmlns:android="http://schemas.android.com/apk/res/android">
    Your content here
</merge>

And

<ScrollView
  android:layout_width="match_parent"
  android:layout_height="match_parent">       
    <include layout="@layout/yourlayout"/>
</ScrollView>

See http://developer.android.com/training/improving-layouts/reusing-layouts.html

Upvotes: 3

Hussein El Feky
Hussein El Feky

Reputation: 6707

Well, obviously you can't scroll the screen in Android Studio, but you can set the visibility of any parent view to gone to see how your off-screen views look like, then change it back by removing the visibility attribute in xml.

You can also copy the views that are off-screen and paste them in another new layout for testing purposes only to see how it looks like.

Generally, you can just run the emulater in Android Studio and see how your design looks like too.

Upvotes: 0

Related Questions