-1

當前佈局如何更改主要和主要顏色?

main layout view image

我有關於XML佈局的問題,我不知道如何添加和小學深色。有誰能夠幫助我?

main.xml中

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" > 
     <ListView android:id="@+id/in" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:stackFromBottom="true" 
       android:transcriptMode="alwaysScroll" 
       android:layout_weight="1"/> 

     <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
     <EditText android:id="@+id/edit_text_out" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_weight="1" 
        android:layout_gravity="bottom"/> 
     <Button android:id="@+id/button_send" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/send"/> 
    </LinearLayout> 
</LinearLayout> 

應該怎麼看起來像

Need this layout

回答

-1

你的意思是你需要改變操作欄的位於最頂端位置正確的顏色嗎?那麼這樣做 - 因此,ActionBar將不適用於API級別爲10(Android 2.3.3)的目標環境。

以防萬一,如果您指定的最低API等級11,你可以通過定義自定義樣式更改ActionBar的背景顏色,如:

<resources> 
<style name="MyTheme" parent="@android:style/Theme.Holo.Light"> 
    <item name="android:actionBarStyle">@style/MyActionBar</item> 
</style> 

<style name="MyActionBar"  parent="@android:style/Widget.Holo.Light.ActionBar"> 
    <item name="android:background">ANY_HEX_COLOR_CODE</item> 
</style> 

而且,設置「的MyTheme」爲主題應用程序/活動。

+0

我應該選擇哪一個API級別? – Yakuza

+0

你可以使用任何大於11的api級別 – sud

+0

@yzaza如果你覺得這有幫助請評論 – sud

2

你應該修改或創建如果它沒有已經存在的文件styles.xml,在價值觀的文件夾,這樣的:

<style name="MyMaterialTheme.Base" > 
    <!-- Primary Color --> 
    <item name="colorPrimary">@color/colorPrimary</item> 
    <!-- darker variant for the status bar and contextual app bars --> 
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item> 
    <!-- theme UI controls like checkboxes and text fields --> 
    <item name="colorAccent">@color/colorAccent</item> 
</style> 

它得到它從colors.xml文件中的值。