how can i display a listview on the top of another activity in Android

谁说我不能喝 提交于 2019-12-18 09:40:03

问题


i am having a custom list view screen and another activity screen but now i want to display the custom list view screen is on top of the another activity ..

thanks for help...


回答1:


Well you should firstly really specify what you really expect as Commons Guy said.

But according to me you can set theme Translucent to achieve that.

Heres a sample in your manifest specify android:style/Theme.Translucent

<!-- Your Custom ListActivity  -->
<activity android:name=".CustomListVIew"
        android:theme="@android:style/Theme.Translucent"/>

now if you want to blur the background, before calling setContentView() from you Custom ListView

public class CustomListActivity extends ListActivity{
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
//NO NEED TO CALL BELOW METHOD IF YOU DON'T WANT BLUR
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
        WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
}
    setContentView(R.layout.main);

Now call you CustomListActivity from your another Activity in onCreate() by

statActivity(new Intent(AcivityA.this,CustomListActivity.class));


来源:https://stackoverflow.com/questions/4547511/how-can-i-display-a-listview-on-the-top-of-another-activity-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!