android:layout_gravity="top/right"
出错的是这一句。
实际上应该是:
android:layout_gravity="top|right",这里的top和right的关系是并行的。
再说说layout_gravity的用法:
<p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px;">属性可选的值有:</p><p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px;">top、bottom、left、right、center_vertical、fill_vertical、center_horizontal、fill_horizontal、center、fill、clip_vertical。</p><p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px;">而且这些属性是可以多选的,用“|”分开。</p><p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px;">默认这个的值是:Gravity.LEFT</p><p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px;">来自:</p><p style="color: rgb(51, 51, 51); font-family: Arial; font-size: 14px; line-height: 26px;">http://blog.csdn.net/wanderocn/article/details/6424876
</p>