我目前正在制作一个android应用程序,我使用了标题栏,因此标题栏的所有内容都保存在window_title.xml中,我已将LinearLayout设置为:paddingLeft =“5dip”。现在我需要加载一个imageView在这个titleBar的右侧,我怎么能够覆盖这个paddingLeft我不能删除它,因为它需要左边的文本和图像,但我也需要它在右边...在Android上的LinearLayout中覆盖paddingLeft
这是当前xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="50dip"
android:gravity="center_vertical"
android:paddingLeft="5dip"
android:background="#222222">
<ImageView
android:id="@+id/header"
android:src="@drawable/header"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:text="TextTexast"
android:textSize="10pt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingLeft="5dip"
android:textColor="#F7F7F7"
/>
</LinearLayout>
尝试像那样。但还是一样的。这里有图片可以帮助你:http://shrani.si/f/k/r5/2y9AMubw/img.png所以我需要将这个灰色的形状从左上角移到右下角。正如我在LinearLayout paddingRight中它只是忽略了我在ImageView中指定的内容。 – HyperX 2011-12-20 20:57:36
因此,如果它不适合你@HyperX,你为什么将它标记为接受的答案? – StackOverflowed 2012-07-06 10:05:29