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_User Interface - Fatal编程技术网

android:如何创建像这样的对角线图像视图?

android:如何创建像这样的对角线图像视图?,android,xml,user-interface,Android,Xml,User Interface,我需要创建如下布局: 我创建了一个像这样的简单布局,但它不适合我,我需要一个像上传图像这样的布局 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/frame1"

我需要创建如下布局:

我创建了一个像这样的简单布局,但它不适合我,我需要一个像上传图像这样的布局

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/frame1"
    android:orientation="vertical"
    >
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="0.7"
        android:orientation="vertical"
    />
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="4.5"
        android:orientation="horizontal"
        >
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1.8"
        />
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="fill_parent"
            android:layout_weight="5"
            >
            <ImageView
                android:id="@+id/id1"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:scaleType="matrix"
                android:background="@drawable/frame1_selector"
                android:src="@drawable/earth"
            />
        </LinearLayout>
        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1.4"
        />
    </LinearLayout>
    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="2.8"
        android:orientation="vertical"
    />
</LinearLayout>


我搜索了互联网,但没有找到基于xml的解决方案。

可能是这样,可以通过设置
ImageView
的动画旋转45°,并设置
fillEnabled=true
fillAfter=true
,使
ImageView
即使在动画完成后仍保持在该位置(45°)


另外,将动画的持续时间设置为“1”"这样动画就可以悄悄地进行。

这是一个具有两个透明区域的正常PNG图像。imageview将显示来自用户的不同图像,您的解决方案适用于这种情况吗?是的。您可以简单地:1通过倾斜图像来扭曲图像。或2应用一个简单的遮罩,使用适当的
PorterDuff XFerMode切割两个透明区域
。我更喜欢第二种解决方案(非失真)。如果您仍然想知道如何:我需要在这样的广告牌上证明图像的合理性:,