1

Ich habe ein allgemeines Hauptmenü, das mit einem Dialogfragment erscheint, wenn ein Bild gedrückt wird. Dies funktionierte auf dem Galaxy Tab S2 9.7 Tablet mit 5.1 Lollipop problemlos. Nach dem Upgrade auf 6.0.1 erscheint es jedoch nicht mehr. Stattdessen sieht das Menü so aus, als ob es eingeblendet werden soll und der Bildschirm wird abgeblendet, so wie das Menü dort ist, aber nichts erscheint auf dem Bildschirm. Wenn ich den Bildschirm berühre, wird der Bildschirm heller und bringt mich zur ursprünglichen Hauptaktivität zurück, als ob ich außerhalb von DialogFragment geklickt hätte.DialogFragment Leer und ausgegraut auf Marshmallow

Ich habe alle meinen Code überprüft und alles checkt aus was ich sehen kann. Ich frage mich, ob dies ein Problem mit dem Dialog selbst sein könnte, und nicht mit der aufrufenden Aktivität. Hier

ist der Code für die anrufende Aktivität:

optionMenu = (ImageView) findViewById(R.id.optionGear); 
optionMenu.setOnClickListener(new View.OnClickListener() { 

     @Override 
     public void onClick(View v) { 

      FragmentTransaction ft = getFragmentManager().beginTransaction(); 
      Fragment prev = getFragmentManager().findFragmentByTag("dialog"); 
      if (prev != null) { 
       ft.remove(prev); 
      } 

      DialogFragment editNameDialog = MainMenuDialog.newInstance("Set Event ID"); 
      //MainMenuDialog editNameDialog = MainMenuDialog.newInstance("Set Event ID"); 
      Bundle args = new Bundle(); 
      args.putString("ID", eventID); 
      editNameDialog.setArguments(args); 
      editNameDialog.show(ft, "dialog"); 

     } 
    }); 

Hier ist ein Code-Snippet aus dem Dialog:

@Override 
public View onCreateView(LayoutInflater inflater, ViewGroup container, 
         Bundle savedInstanceState) { 
    return inflater.inflate(R.layout.fragment_main_menu, container); 



} 

@Override 
public void onViewCreated(final View view, @Nullable Bundle savedInstanceState) { 
    super.onViewCreated(view, savedInstanceState); 

    getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN); 

Hier ist der Code für die XML:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/options_menu" 
android:layout_width="290dp" android:layout_height="460dp" 
android:layout_gravity="center" android:orientation="vertical" 
android:background="#7bffffff" 
android:visibility="visible"> 

<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:id="@+id/textView" 
    android:enabled="false" /> 

<TextView 
    android:id="@+id/textView4" 
    android:text="EVENT INFORMATION" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:textSize="20sp" 
    android:textStyle="bold" 
    android:typeface="sans" 
    android:textColor="#ffffff" 
    android:textAlignment="center" 
    android:background="#ce2127" /> 

<TextView 
    android:id="@+id/lbl_your_name" android:text="Event ID: (Must be in all caps)" 
    android:layout_width="match_parent" android:layout_height="wrap_content" 
    android:textStyle="bold" 
    android:textSize="20sp" 
    android:textColor="#000000" 
    android:layout_marginTop="10dp" 
    android:textAlignment="center" /> 

<EditText 
    android:id="@+id/event_id" 
    android:layout_width="match_parent" android:layout_height="wrap_content" 
    android:inputType="text|textCapCharacters" 
    android:imeOptions="actionDone" 
    android:textColor="#000000" 
    android:textAlignment="center" /> 

<TextView 
    android:id="@+id/textView2" 
    android:text="Re-Enter Event ID:" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:textStyle="bold" 
    android:textSize="20sp" 
    android:textColor="#000000" 
    android:textAlignment="center" /> 

<EditText 
    android:id="@+id/confirmEvent" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:inputType="text|textCapCharacters" 
    android:imeOptions="actionDone" 
    android:textColor="#000000" 
    android:textAlignment="center" /> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_gravity="center_horizontal" 
    android:gravity="center_horizontal"> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:text="CLEAR TEXT" 
     android:id="@+id/clearButton" 
     android:background="#a0a0a0" 
     android:textColor="#ffffff" /> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:text="CANCEL" 
     android:id="@+id/cancelButton" 
     android:background="#ce2127" 
     android:textColor="#ffffff" 
     android:layout_marginLeft="15dp" 
     android:layout_gravity="center_horizontal" /> 

    <Button 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:text="SAVE" 
     android:id="@+id/saveButton" 
     android:background="#009634" 
     android:textColor="#ffffff" 
     android:layout_marginLeft="15dp" 
     android:layout_gravity="right" /> 

</LinearLayout> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="20dp" 
    android:id="@+id/textView3" 
    android:enabled="false" 
    android:background="#000000" 
    android:layout_marginTop="10dp" /> 

<TextView 
    android:id="@+id/uploadTitle" 
    android:text="NON-UPLOADED VIDEOS" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:textSize="20sp" 
    android:textStyle="bold" 
    android:typeface="sans" 
    android:textColor="#ffffff" 
    android:textAlignment="center" 
    android:background="#ce2127" 
    android:layout_marginBottom="10dp" /> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="# VIDEOS TO UPLOAD:" 
     android:id="@+id/textView5" 
     android:textSize="20sp" 
     android:textStyle="bold" 
     android:textColor="#000000" /> 

    <TextView 
     android:layout_width="60dp" 
     android:layout_height="wrap_content" 
     android:text="0" 
     android:id="@+id/videoCount" 
     android:textSize="20sp" 
     android:textStyle="bold" 
     android:textColor="#000000" 
     android:textAlignment="textEnd" /> 
</LinearLayout> 

<Button 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:text="CLICK TO UPLOAD VIDEOS" 
    android:id="@+id/uploadButton" 
    android:textStyle="bold" 
    android:textColor="#000000" 
    android:textSize="20sp" 
    android:layout_marginTop="10dp" 
    android:layout_marginBottom="10dp" /> 

<TextView 
    android:id="@+id/uploadStatus" 
    android:text="UPLOAD STATUS: IDLE" 
    android:layout_width="match_parent" 
    android:layout_height="30dp" 
    android:textSize="20sp" 
    android:textStyle="bold" 
    android:typeface="sans" 
    android:textColor="#000000" 
    android:textAlignment="center" /> 

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center_horizontal"> 

    <TextView 
     android:id="@+id/textView6" 
     android:text="Application Version: " 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textSize="15sp" 
     android:textStyle="bold" 
     android:typeface="sans" 
     android:textColor="#000000" 
     android:textAlignment="center" 
     android:layout_marginTop="10dp" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/verNumber" 
     android:textSize="15sp" 
     android:textStyle="bold" 
     android:typeface="sans" 
     android:layout_marginTop="10dp" /> 
</LinearLayout> 

Ich habe in der Vergangenheit gesehen, dass auf diesen Samsung-Geräten durch das Touchwiz-Overlay seltsame Störungen auftreten.

Jede Hilfe würde sehr geschätzt werden!

Antwort

0

Stellt sich heraus, dass Android 6.0.1 ein Problem mit XML-Layouts hat, beginnend mit dem von mir gewählten linearen Layout.

Ich beendete das lineare Layout in einem Standard-FrameLayout und BAM, alles zeigte sich!

interessant ....

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/options_menu" 
android:layout_width="290dp" android:layout_height="460dp" 
android:layout_gravity="center" android:orientation="vertical" 
android:background="#7bffffff">> 
1

Wrapping nicht für mich arbeiten, aber ich es endgültig fixiert mit dem Hinzufügen von requestFeature (Window.FEATURE_NO_TITLE):

override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { 
    val dialog = super.onCreateDialog(savedInstanceState) 
    dialog.window.requestFeature(Window.FEATURE_NO_TITLE) 
    return dialog 
}