1

I am developing a simple app in Android Studio, and I am testing it on a real device (Asus zenfone 5 & Android 4.4.2). In the main activity I have applied this layout:

<LinearLayout 
 xmlns:android="http://schemas.android.com/apk/res/android" 
 xmlns:tools="http://schemas.android.com/tools" 
 tools:context="madapps.mysecondapp.MainActivity"  

 android:id="@+id/activity_main" android:layout_width="match_parent"     
 android:layout_height="match_parent"
 android:paddingTop="?android:attr/actionBarSize" 
 android:orientation="horizontal" 
 android:background="@drawable/background_deathstar">

  <EditText 
      android:id="@+id/edit_message" 
      android:text="@string/message" android:layout_weight="1"     
      android:layout_width="0dp" android:layout_height="wrap_content" 
      android:hint="@string/edit_message" android:textColor="#FFF" />

  <Button android:layout_width="wrap_content"     
      android:layout_height="wrap_content" 
      android:text="@string/button_send" 
      android:onClick="sendMessage" />
</LinearLayout>

with this style.xml applied to the activity

<resources>
   <style name="AppTheme" parent="android:Theme.Holo">
        <item name="android:windowActionBarOverlay">true</item>
   </style>
</resources>

What I want to do is testing a background image on different screen sizes and densities (dpi). Now, the problem is that while in my physical device the property

    android:windowActionBarOverlay

is applied properly, laying out my action bar on top of my background image, this is not working equally within Android Studio's layout editor, meaning that my image begins at the end of the action bar.

ps. I have also noticed that apart from ignoring the windowActionBarOverlay property, my action bar fails to load my custom action buttons. I think these two problems are somewhat related.

Any suggestions?

Thank you very much

4

1 回答 1

0

显然我不应该期望 Android Studio 的布局编辑器能够反映我在设备上看到的内容,因为它只使用了真正的 Android 布局系统的一个子集。实际上我的操作栏是隐藏并以编程方式显示的,而布局编辑器只是应该用作在编辑 XML 时拖放小部件和预览布局的一种方式。

于 2015-03-05T10:30:41.770 回答