简体   繁体   中英

Make an Activity just a pop up window

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>

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM