android禁止滾動
① Android 滾動條 ProgressBar 怎麼停止
您好,很高興能幫助您
如果你把內容包含在ScrollView中,當內容超出高度時會自動出現滾動條。
另外,使用控制項HorizontalScrollView 來包住你的內容時,
如果你的內容假設是一個LinearLayout, 那麼當LinearLayout的寬度超過屏幕時, 將會自動產生滾動條,當你拖動滑鼠時,效果跟scrollView一樣,不過是橫向而己
例:
縱向滾動
<ScrollView>
<LinearLayout ........>
<TextView ...../>
<TextView ...../>
<TextView ...../>
<TextView ...../>
</LineraLayout>
</ScrollView>
模向滾動
<HorizontalScrollView >
<LinearLayout ........>
<TextView ...../>
<TextView ...../>
<TextView ...../>
<TextView ...../>
</LineraLayout>
</HorizontalScrollView >
有時候甚至可以做到橫向縱向都支持,只需要你合理設計就可以, 注意ScrollView中只能加一個控制,不能超過兩個
你的採納是我前進的動力,
記得好評和採納,答題不易,互相幫助,
② android 如何禁止scrollview 滾動
android scrollview組件禁止滑動的方法;
xml配置:
android:id="@+id/sc_freement"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@id/category_line"
android:scrollbars="none"
android:fadingEdge="none">
</<span style="line-height: 21px; ">ScrollView>
java代碼控制:
ScrollView scrollView = (ScrollView)this.findViewById(R.id.sc_freement);
scrollView.setOnTouchListener(new View.OnTouchListener(){
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
return true;
}
});