修正了滚动型的Andr​​oid背景图片 [英] Fix background image on Scrollview Android

查看:134
本文介绍了修正了滚动型的Andr​​oid背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我用滚动型我codeS我的背景图片拉伸和滚动的按钮。我只想按钮滚动,而不是背景。我重视你可以算出来的相关图片。
下面是XML文件:

When I use Scrollview in my codes my background image stretches and scrolls with buttons. I want just buttons scroll, not the background. I have attached a related image that you can figure this out. Here is the XML file:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="fill_parent"
                  android:background="@drawable/back"
                  android:orientation="vertical" >


        <ImageButton
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/app"
                android:layout_gravity="center"
                android:background="@drawable/bluebutton"
                android:layout_marginTop="80dp"
                android:layout_marginRight="80dp"
                android:layout_marginLeft="80dp"

                />

        <ImageButton
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:id="@+id/moshiri"
                android:background="@drawable/bluebutton"
                android:layout_marginTop="8dp"
                android:layout_marginRight="80dp"
                android:layout_marginLeft="80dp"
                />
        <ImageButton
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"

                android:id="@+id/about"
                android:background="@drawable/bluebutton"
                android:layout_marginTop="8dp"
                android:layout_marginRight="80dp"
                android:layout_marginLeft="80dp"
                />
        <ImageButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"

                android:id="@+id/exit"
                android:background="@drawable/bluebutton"
                android:layout_marginTop="8dp"
                android:layout_marginRight="80dp"
                android:layout_marginLeft="80dp"
                />

    </LinearLayout>
</ScrollView>

推荐答案

在滚动型设置背景图片,并添加填充到滚动型或边距到的LinearLayout。

Set the background image on the ScrollView and add Padding to the ScrollView or Margins to the Linearlayout.

这篇关于修正了滚动型的Andr​​oid背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆