简体   繁体   English

在Android中重复图像的问题

[英]Issue with repeating image in Android

I have view which should show the winner in the middle, I want to add bottom zigzag border, so far so good. 我认为应该在中间显示获胜者,我想添加底部的锯齿形边框,到目前为止效果很好。 Only issue I have when I add the image and make it fitXY it only repeats until middle of view (TableRow). 添加图像并使其适合XY时出现的唯一问题是,它仅重复到视图中间(TableRow)。 Any idea how to make it to do it full screen? 知道如何使其全屏显示吗?

Here is the winner.xml 这是winner.xml

  <RelativeLayout
    android:id="@+id/winner"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/red_transparent"
    android:visibility="invisible" >

    <TableLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="center"
        android:stretchColumns="field"
        android:weightSum="9" >

        <TableRow
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="3"
            android:gravity="bottom" >

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="12dp"
                android:adjustViewBounds="true"
                android:gravity="bottom"
                android:scaleType="fitXY"
                android:src="@drawable/zigzag_bottom" />
        </TableRow>

        <TableRow
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="2"
            android:background="#ffffff"
            android:gravity="center_horizontal|center_vertical" >

            <RelativeLayout
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:background="@drawable/back"
                android:gravity="center_horizontal|center_vertical" >

                <ImageView
                    android:id="@+id/winner_logo"
                    android:layout_width="50sp"
                    android:layout_height="50sp"
                    android:layout_centerHorizontal="true"
                    android:background="@drawable/back"
                    android:contentDescription="@string/app_name"
                    android:src="@drawable/vertical" />

                <TextView
                    android:id="@+id/winner_info"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/winner_logo"
                    android:layout_centerHorizontal="true"
                    android:background="@drawable/back"
                    android:contentDescription="@string/app_name"
                    android:src="@drawable/horizon"
                    android:text="@string/winner"
                    android:textColor="#880000"
                    android:textSize="64sp" />
            </RelativeLayout>
        </TableRow>

        <TableRow
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="4" >

            <ImageView
                android:layout_width="fill_parent"
                android:layout_height="12dp"
                android:adjustViewBounds="true"
                android:background="@drawable/back"
                android:gravity="top"
                android:scaleType="fitXY"
                android:src="@drawable/zigzag_bottom" />
        </TableRow>
    </TableLayout>
   </RelativeLayout>

And here is the repeatable image 这是可重复的图像

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:antialias="true"
    android:src="@drawable/zigzagdown"
    android:tileMode="repeat" />

I found issue 我发现问题

android:stretchColumns="field" android:stretchColumns =“ field”

should be android:stretchColumns="*", so it will stretch all columns 应该是android:stretchColumns =“ *”,所以它将拉伸所有列

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM