app_density = metrics.density;
screen_width = metrics.widthPixels;
screen_height = metrics.heightPixels;
int height =screen_width * 1096 / 640;
ScrollView scrollView = (ScrollView) findViewById(R.id.sl_image_bg);scrollView.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
return true;
}
});
findViewById(R.id.iv_home).setLayoutParams(
new FrameLayout.LayoutParams(Utils.getScreenWidth(), height));
<ScrollView
android:id="@+id/sl_image_bg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:alwaysDrawnWithCache="false"
android:fadingEdge="none"
android:overScrollMode="never" // 去掉滑动到头时两边的阴影
android:persistentDrawingCache="none" //去掉两头泛色的过渡地带
android:scrollbars="none" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="@+id/iv_home"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/bg" />
</FrameLayout>
</ScrollView>