Make an Activity just a pop up window

耗尽温柔 提交于 2019-12-11 01:51:47

问题


I am currently making a program which is supposed to prompt the user to choose a certain bluetooth device it would like to connect to. I have it set up in my code through the options menu.

What I want it to look like is the BlueTerm's pop up window. I actually have the code from BlueTerm ( as it is free to look at ), but I cannot figure out how to make the window appear as a pop up instead of a full screen view. This is a link to the picture of the pop up window: https://play.google.com/store/apps/details?id=es.pymasde.blueterm&hl=en

Is it done in the xml file? because I cannot find a difference in my XML file to theirs which would cause this error.

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
  android:orientation="vertical" 
  android:layout_width="fill_parent" 
  android:layout_height="fill_parent">
  <TextView android:id="@+id/title_paired_devices" 
  android:layout_width="fill_parent" 
  android:layout_height="wrap_content" 
  android:text="@string/title_paired_devices" 
  android:visibility="gone" 
  android:background="#666" 
  android:textColor="#fff" 
  android:paddingLeft="5dp" /> 
  <ListView android:id="@+id/paired_devices" 
  android:layout_width="fill_parent"
   android:layout_height="wrap_content" 
   android:stackFromBottom="true" 
   android:layout_weight="1" /> 
  <TextView android:id="@+id/title_new_devices" android:layout_width="fill_parent"       android:layout_height="wrap_content" android:text="@string/title_other_devices" android:visibility="gone" android:background="#666" android:textColor="#fff" android:paddingLeft="5dp" /> 
  <ListView android:id="@+id/new_devices" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stackFromBottom="true" android:layout_weight="2" /> 
  <Button android:id="@+id/button_scan" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/button_scan" /> 
  </LinearLayout>

回答1:


You have to define theme of that activity to Theme.Dialog in AndroidManifest.xml file

Example:

<activity android:name="AleartMeassage" android:theme="@android:style/Theme.Dialog"></activity>


来源:https://stackoverflow.com/questions/11021365/make-an-activity-just-a-pop-up-window

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