42027

I need help to make Popup in this fragment below [duplicate]

Question:

This question already has an answer here:

<ul><li> <a href="/questions/2795300/how-to-implement-a-custom-alertdialog-view" dir="ltr" rel="nofollow">How to implement a custom AlertDialog View</a> <span class="question-originals-answer-count"> 11 answers </span> </li> </ul>

I have an activity.java which is contains some fragments like those below, and on one of these fragments I want to make a popup window. I tried a lot of things but all failed.

Now I am showing my code here to see if someone can help me.

Here is my fragment.java:

<pre class="lang-java prettyprint-override">public class Info extends Fragment { public Info() { // Required empty public constructor } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.kaynaklar_info, container, false); }

Here is my fragment xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:id="@+id/kaynaklarinfo" android:layout_height="match_parent"> <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/scrollView3" > <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/pozitif" android:id="@+id/infonuniciresim" /> </ScrollView>

Here is my popup xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/popup_element" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffffff" android:padding="10px" android:orientation="vertical"> <TextView android:layout_width="wrap_content" android:id="@+id/deneme" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:text="Transfering data" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:text="Status" /> <TextView android:id="@+id/server_status_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Awaiting answer..." android:paddingLeft="10sp" />

Answer1:

The popup window in Android is called as <a href="https://developer.android.com/guide/topics/ui/dialogs.html" rel="nofollow">AlertDialog</a> and you can see how to build a custom dialog <a href="http://www.mkyong.com/android/android-custom-dialog-example/" rel="nofollow">here</a>.

Recommend

  • Multiple ViewPagers in on Activity
  • Why Touch not work on google map v2?
  • Android Music Player inside a fragment
  • set onClickListener in getview() with ViewHolder class
  • How to store edit text data from an Android dialog?
  • How to save state of CheckBox while scrolling in ListView?
  • Fragment tabhost is not working in Fragment
  • Why setOnCheckedChangeListener not working in a popup that uses LayoutInflater?
  • Binary XML file line #26: Duplicate id, tag null, or parent id with another fragment
  • Android List Fragment with fixed Header
  • List view crashes when scrolling “The application may be doing too much work on its main thread.”
  • Where are files stored on an Android emulator?
  • android-How to enable cache or buffering when videoView have downloaded a video
  • OnItemSelectedListener for Spinner that was added programmatically does not trigger
  • Variant from android-autofittextview library : scaling makes strange behaviour
  • SearchView WITHOUT ACTIONBAR [duplicate]
  • Listview - list item selection and initial setting (custom made items)
  • UIScrollView setContentOffset: animated: not working
  • Google Maps getMap returns null
  • Installing libCurl - ruby 1.9.3 .. rails 3.2.12 .. Windows
  • Replace Fragment with another on back button
  • How to create a new Bundle object?
  • How to upload specific List image using click on Upload button
  • How to Make a Spinner (In a Fragment) That Changes the App's Language?
  • Blackberry 6: how to detect a long click on track pad?
  • Wrong row deleted from custom listview with spinner
  • How to get listview position?
  • Syntax error on tokens, AnnotationName expected instead - error on query
  • Spring boot 2.0.0.M4 required a bean named 'entityManagerFactory' that could not be found
  • Creating Java object from class name with constructor, which contains parameters [duplicate]
  • Connect .sks to skscene.h
  • how to avoid repetitive constructor in children
  • How can I set a binding to a Combox in a UserControl?
  • Create DicomImage from scratch using Dcmtk
  • How to test if a URL from an Eclipse bundle is a directory?
  • how to do an event when i swipe from fragment to the other
  • Deleting and Updating values from a cusrsor adapter
  • Possible to stop flickering java tooltip in heavyweight mode?
  • Cannot Parse HTML Data Using Android / JSOUP
  • Angular 2 constructor injection vs direct access