我目前正在製作一個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