转载自:http://dev.10086.cn/cmdn/bbs/thread-70725-1-1.html
网上刚看到的一个实用技巧,希望对大家有帮助By default android comes with a scroll bar for scrolling across up and down , but in some specific application we may need to hide the scroll bar and still we should be able to scroll down. So far that kind of application here is the trick to hide the seek bar.
xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        xmlns:android="http://schemas.android.com/apk/res/android">
        <ScrollView android:id="@+id/ScrollView01"
                android:layout_width="wrap_content" android:layout_height="100px">
                <LinearLayout android:id="@+id/LinearLayout02"
                        android:layout_width="wrap_content" android:layout_height="wrap_content"
                        android:orientation="vertical">
                        <Button android:id="@+id/Button01" android:layout_width="wrap_content"
                                android:layout_height="wrap_content" android:text="But1"></Button>
                        <Button android:id="@+id/Button02" android:layout_width="wrap_content"
                                android:layout_height="wrap_content" android:text="But2"></Button>
                        <Button android:id="@+id/Button03" android:layout_width="wrap_content"
                                android:layout_height="wrap_content" android:text="But3"></Button>
                </LinearLayout>
        </ScrollView>
</LinearLayout>
复制代码
Java file
public class HideScrollBarExample extends Activity {        @Override
        public void onCreate(Bundle icicle) {
                super.onCreate(icicle);
                setContentView(R.layout.main);                ScrollView sView = (ScrollView)findViewById(R.id.ScrollView01);
//              Hide the Scollbar
                sView.setVerticalScrollBarEnabled(false);
                sView.setHorizontalScrollBarEnabled(false);
        }
}
复制代码The output will looks like
1st image is before scrollbar hide & 2nd image is after scrollbar hide