這是非常簡單的,我有這個代碼比我從另一個問題獲得,並開始分析它,以瞭解如何使圖標位置在ActionBar的左上角:如何在操作欄的左上方放置圖標? (或如何消除那空白的空白?)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/linear"
android:orientation="vertical"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView
android:id="@+id/titleTextView"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="25dp"
android:gravity="center_vertical"
android:paddingTop="5dp"
android:text="Title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="30dp" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<TextView
android:id="@+id/descriptionTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginLeft="25dp"
android:height="30dp"
android:text="Description"
android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>
</LinearLayout>
<RelativeLayout
android:id="@+id/flagLayout"
android:layout_width="15dp"
android:layout_height="70dp"
android:background="#5416B4"
android:layout_alignParentLeft="true" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageView"
android:layout_width="90dp"
android:layout_height="70dp"
android:layout_alignParentRight="true"
android:background="#ffa500" />
</RelativeLayout>
</RelativeLayout>
此代碼是另一個問題的例子:
Xamarin Android | Layout style
但事實是,由於某種原因,它呈現這樣的:
紅圈是我加的東西,它是問題的中心,它爲什麼渲染那個空間?我怎麼能消除它?
換句話說,我該如何將一個icone放在actionBar的左上角?
如果你作出答案教導如何改變它的工具欄或類似的東西,並在左上角放置一個圖標,它也將被視爲一個有效的答案。
感謝您的關注。