1

我正在Android Studio中开发一个简单的应用程序,并且正在真实设备上测试它(Asus zenfone 5 & Android 4.4.2)。在主要活动我申请这个布局:Android Studio的布局编辑器未能应用android:windowActionBarOverlay属性

<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> 

与此style.xml应用到活动

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

我想要做的是测试在不同的屏幕尺寸和密度的背景图像(什么DPI)。 现在的问题是,虽然在我的物理设备的属性

android:windowActionBarOverlay 

正确应用,奠定了我的操作栏上我的背景图像的顶部,这不是Android Studio中的布局编辑器内平均工作,这意味着我的图像从操作栏的末尾开始。

ps。我还注意到,除了忽略windowActionBarOverlay属性,我的操作栏无法加载我的自定义操作按钮。我认为这两个问题有些相关。

有什么建议吗?

非常感谢您

回答

0

显然我应该没有预期的Android Studio的布局编辑器,以反映我所看到的设备,因为它仅使用真正的Android布局系统的一个子集。 其实我的行动条被隐藏并以编程方式显示,并且布局编辑器只能用作拖放窗口小部件并在编辑XML时预览布局的方式。

相关问题