1

У меня есть общее главное меню, которое появляется с помощью диалогового фрагмента при нажатии изображения. Это работало без проблем на планшете Galaxy Tab S2 9.7, когда он использовал 5.1 Lollipop. Однако при обновлении до 6.0.1 он больше не появляется. Вместо этого меню выглядит так, как будто оно хочет всплывать, а экран тускнеет, как меню есть, но на экране ничего не появляется. когда я касаюсь экрана, экран становится ярче и возвращает меня к исходному основному действию, как если бы я щелкнул за пределами диалогового окна.DialogFragment Blank и greyed out on Marshmallow

Я проверил весь свой код и все проверяет, что я вижу. Мне интересно, может ли это быть проблемой с самим диалогом, а не с вызывающим действием.

Вот код для Calling деятельности:

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"); 

     } 
    }); 

Вот фрагмент кода из Диалог:

@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); 

Вот код 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> 

Я видел в прошлом, когда на этих устройствах Samsung появляются странные сбои из-за наложения Touchwiz.

Любая помощь была бы принята с благодарностью!

ответ

0

Оказывается, что у Android 6.0.1 возникла проблема с XML-макетами, начиная с линейного макета, который я выбрал.

В итоге я обернул Linear Layout в стандартном FrameLayout и BAM, все появилось!

Интересно ....

<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

Обертывание не работает для меня, но я, наконец, установил его с добавлением 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 
} 
Смежные вопросы