sherlock操作栏的问题

时间:2012-12-19 06:58:20

标签: android android-layout actionbarsherlock

ICS中显示的图像 enter image description here

在姜饼中运行的地方 enter image description here

片段的XML代码

<?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:orientation="vertical"
 android:background="@drawable/background"
 android:id="@+id/homelayout" >

<ImageView
    android:id="@+id/homepageLogo"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:src="@drawable/background"
    android:alpha="255"
    android:scaleType="fitXY" />

</LinearLayout>

出现这种奇怪行为的原因是什么?

2 个答案:

答案 0 :(得分:0)

尝试更改

android:layout_width="match_parent"
android:layout_height="match_parent"

android:layout_width="wrap_content"
android:layout_height="wrap_content"
在ImageView中

。我不知道你如何使用你的XML,但从它的外观来看,你可能还想将LinearLayout中的相同参数更改为“wrap_content”。现在你告诉ImageView(可能)填满整个区域。

// Alex

答案 1 :(得分:0)

仅当您从代码中动态请求操作栏时才会出现此问题。

getWindow().requestFeature(Window.FEATURE_ACTION_BAR);

如果使用样式执行此操作,则不会出现此问题。