Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android:从右到左平铺可绘制_Android_Xml_Imageview_Drawable - Fatal编程技术网

Android:从右到左平铺可绘制

Android:从右到左平铺可绘制,android,xml,imageview,drawable,Android,Xml,Imageview,Drawable,如何制作一个由两个可绘制部件组成的可绘制部件:一个在y轴上重复,另一个在右端“完成” 在我的应用程序中,我是这样使用它的: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/logo_pattern_file" android:tileMode="repeat" android:antialias="true" andr

如何制作一个由两个可绘制部件组成的可绘制部件:一个在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>
<?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>

旁边是带有“末端”的ImageView。问题是,瓷砖部分从左到右绘制,而“作物”不在正确的位置,弄乱了整个徽标

以下是我得到的:

(不允许新用户发布图像,这里有一个指向图像的链接:)

我应该怎样做才对呢?

通过将重复位图嵌套到
rotate
标记中(从左侧到右侧,反之亦然),可以实现这一点,如下所示:

<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>
<?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>

您的布局可以是这样的:

<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>
<?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>