具有右对齐,裁剪,未缩放内容的ImageView

|| 我已经搜索,摆弄和哭泣了好几个小时,但无法弄清楚如何将图像放置到ImageView中,以及如何将图像呈现为未缩放,右对齐以及裁剪超出ImageView左侧的溢出。 ImageView的定义如下:
<ImageView
    android:layout_width=\"fill_parent\" 
    android:layout_height=\"wrap_content\"
    android:src=\"@drawable/bleh\"
></ImageView>
layout_width
设置为
fill_parent
以拉伸和缩小ImageView以适合屏幕。
layout_height
设置为
wrap_content
,因为ImageView始终具有固定的高度(根据图像确定)。 我没有定义“ 5”,因为我的理解是这与ImageView在其父对象内部的位置有关,在这种情况下,因为ImageView的宽度设置为fill_parent,所以它没有任何作用。 使用上面的布局代码,图像可以缩放以适合ImageView。我可以防止缩放的唯一方法是设置
android:scaleType=\"center\"
,它可以防止缩放,但不幸的是使图像居中。 有想法吗?否则,我目前正在尝试以下替代方法: 子类化ImageView并实现我自己的onDraw()方法。 将全图像大小的ImageView放到ScrollView中,并将滚动固定到最右边(并禁用任何指示它是滚动视图的指示)。     
已邀请:
而不是滚动视图-将图像放在LinearLayout或RelativeLayout内。使布局的layout_width fill_parent和layout_height包装内容。然后在ImageView上,使用布局重力right和wrap_content分别设置宽度和高度。
<LinerLayout android:layout_width=\"wrap_content\" 
  android:layout_height=\"wrap_content\">
<ImageView android:layout_gravity=\"right\"
  android:layout_width=\"wrap_content\" 
  android:layout_height=\"wrap_content\"
  android:src=\"@drawable/bleh\"/>
</LinearLayout>
    
@harmanjd:您做了一个小错误,这是正确的方法: (对不起,我无法评论您的回答)
<LinearLayout android:layout_width=\"fill_parent\" 
     android:layout_height=\"wrap_content\"
     android:gravity=\"right\">

    <ImageView 
            android:layout_width=\"wrap_content\" 
            android:layout_height=\"wrap_content\"
            android:src=\"@drawable/bleh\"/>
    />
</LinearLayout>
    

要回复问题请先登录注册