ScrollView
我想用ScrollView实现图片的水平滚动的功能,用ImageButton放图片的 可是就是不能全屏 请高手帮忙啊
package my.scrollview;import android.app.Activity;import android.os.Bundle;import android.view.WindowManager.LayoutParams;import android.widget.ImageButton;import android.widget.LinearLayout;public class ScrollviewActivity extends Activity { private LinearLayout linear = null; private ImageButton img = null; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); }}
<?xml version="1.0" encoding="utf-8"?><HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillViewport="true" > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:id="@+id/linear" > <ImageButton android:id="@+id/img" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_vertical" android:src="@drawable/p3" /> <ImageButton android:id="@+id/img1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_vertical" android:src="@drawable/p1" /> <ImageButton android:id="@+id/img2" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_vertical" android:src="@drawable/p2" /> <ImageButton android:id="@+id/img3" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_vertical" android:src="@drawable/p4" /> <ImageButton android:id="@+id/img4" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center_vertical" android:src="@drawable/p6" /> </LinearLayout></HorizontalScrollView>