【发布时间】:2014-08-01 18:46:11
【问题描述】:
我的活动和操作栏中有一个列表视图,活动设置为透明和向上导航。结果显示正确,但第一项显示在 actionBAR 下方。如下图:
下面是我用来使栏透明的代码:
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
ActionBar actionBar = getActionBar();
actionBar.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
actionBar.setStackedBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
getActionBar().setDisplayHomeAsUpEnabled(true);
getActionBar().setDisplayShowHomeEnabled(false);
setContentView(R.layout.invite_friends);
invite_friends.XML 用于 listView:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/bluebackground"
android:orientation="vertical" >
<ListView
android:id="@+id/person_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:divider="#b5b5b5"
android:dividerHeight="1dp"
android:listSelector="@drawable/list_selector" />
</LinearLayout>
令人惊讶的是列表视图认为它是全屏的?如何解决这个问题?
谢谢!
【问题讨论】:
-
你可以为这个活动发布你的 xml 吗?
-
如果你向下滚动,我认为这种行为是正常的
-
@jamesgates1 用 XML 代码更新了我的问题
-
@zozelfelfo 我没听懂,能解释一下吗?