2016-03-26 124 views
0

我在相对版面上有一个imageview。 您可以在截图中看到:enter image description here 我如何可以移动在右下角的ImageView的(在WEEL),但显示的是只有25%的部分,就像在后续图片: enter image description hereImageView超出版面范围

谢谢前进!

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" android:layout_height="match_parent" 
android:background="#E0E0E0" 
    > 
<com.androidsources.welcomescreen.MyRecyclerView 
    android:foreground="?android:attr/selectableItemBackground" 
    android:clickable="true" 
    android:id="@+id/cardList" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    /> 
    <com.anupcowkur.wheelmenu.WheelMenu 
    android:id="@+id/wheelMenu" 
    android:layout_width="300dp" 
    android:layout_height="300dp" 


    android:src="@drawable/wheel"/> 
    </RelativeLayout> 
+0

张贴您的xml布局 – hehe

+0

请检查编辑过的帖子 – TrulyXax

+0

我想要在任何屏幕尺寸dinamically锚 – TrulyXax

回答

1

你可以尝试这样的事情:

<com.anupcowkur.wheelmenu.WheelMenu 
    android:id="@+id/wheelMenu" 
    android:layout_width="300dp" 
    android:layout_height="300dp" 

    android:layout_alignParentRight="true" 
    android:layout_alignParentBottom="true" 
    android:paddingLeft="150dp" 
    android:paddingTop="150dp" 

    android:src="@drawable/wheel"/> 

alignParentRightalignParentBottom属性将在右下角移动你的小部件。还尝试更改padding以实现所需的视觉效果。

+0

伟大工程,谢谢! – TrulyXax

+0

试过,但它没有为我工作,我想知道为什么?如果我将图像放在linearlayout中,我的作品就会起作用。 – hehe

0

我知道已经有一个答案,但对于那些不能接受答案的人来说,这是一个选择。

出于某种原因,如果我使用RelativeLayout,但我尝试使用LinearLayout时,我无法将视图的一部分放在父级之外。所以我使用的解决方案是将视图放在LinearLayout中,然后将LinearLayout放在父级的底端。

<LinearLayout 
    android:layout_width="300dp" 
    android:layout_height="300dp" 
    android:orientation="horizontal" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentEnd="true"> 

    <ImageView 
     android:layout_width="300dp" 
     android:layout_height="300dp" 
     android:src="@drawable/some_pic" 
     android:layout_marginStart="150dp" 
     android:layout_marginTop="150dp"/> 

</LinearLayout> 

注意的图像的宽度和高度是不match_parent,使用match_parent将缩小图像不能取代它。