简体   繁体   English

如何使活动可滚动?

[英]How can I make an activity scrollable?

Some Buttons in my app are going to set my content View to a layout where is only 1 TextView and a Button. 应用中的某些按钮会将我的内容视图设置为只有1个TextView和一个Button的布局。 I want that my TextView becomming scroll-able but my button should be fixed, so he stands still on the top or on the buttom. 我希望我的TextView成为可滚动显示,但我的按钮应该固定,因此他仍然站在顶部或底部。 At the moment I have ScrollView (see XMLCode below) but everytime I start it on my Android emulator, my app crashes if I click on the button so my layout with scrollview should show up. 目前,我拥有ScrollView(请参见下面的XMLCode),但是每次我在Android模拟器上启动它时,如果我单击按钮,应用程序就会崩溃,因此应该显示带有scrollview的布局。 Every other layout is working but this one not. 其他所有布局均有效,但此布局无效。

Code doesn't appear correctly, here's the link . 代码显示不正确, 这是链接

I've used Linear and Relative layout as well, but I used ConstraintLayout on every layout so there it is as well. 我也使用了线性和相对布局,但是我在每个布局上都使用了ConstraintLayout,所以也是如此。

Any ideas? 有任何想法吗?

只需使用LinearLayout作为根布局,然后添加Button然后scrollview,然后在其中添加TextView

LinearLayout >> [ Button , ScrollView >> TextView ]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM