1

如何制作一个包含两个可绘制对象的可绘制对象:一个在 y 轴上重复,另一个在右端“完成”它?

在我的应用程序中,我这样使用它:

<bitmap  xmlns:android="http://schemas.android.com/apk/res/android"
     android:src="@drawable/logo_pattern_file"
     android:tileMode="repeat"
     android:antialias="true"
     android:dither="false"
     android:filter="false">
 </bitmap>

旁边是带有“结束部分”的 ImageView。问题是,平铺部分从左到右绘制表格并且“裁剪”不在正确的位置,弄乱了整个标志。

这是我得到的:

(新用户不能发图片,图片链接:http: //i.imgur.com/HLqTx.jpg

我应该如何以正确的方式做到这一点?

4

1 回答 1

0

旋转图案

可以通过将重复位图嵌套到标签中来旋转重复位图(从左到右,反之亦然)来实现这一点rotate,就像这样:

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="180"
    android:pivotX="50%"
    android:pivotY="50%" >

    <bitmap
        android:src="@drawable/core"
        android:tileMode="repeat" />

</rotate>

你的布局可能是这样的:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    tools:context=".MainActivity" >

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@drawable/repeat_core" />

    <ImageView
        android:layout_width="95px"
        android:layout_height="match_parent"
        android:src="@drawable/end" />

</LinearLayout>
于 2012-12-26T17:24:09.513 回答