質問編集履歴
2
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -20,12 +20,11 @@ | |
| 20 20 | 
             
                    android:text="Fragment2へ"/>
         | 
| 21 21 |  | 
| 22 22 | 
             
            </androidx.appcompat.widget.LinearLayoutCompat>
         | 
| 23 | 
            -
            コード
         | 
| 24 23 | 
             
            ```
         | 
| 25 24 |  | 
| 26 25 |  | 
| 27 26 | 
             
            ・遷移先Fragment2のxml
         | 
| 28 | 
            -
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 27 | 
            +
            ```<?xml version="1.0" encoding="utf-8"?>
         | 
| 29 28 | 
             
            <androidx.appcompat.widget.LinearLayoutCompat
         | 
| 30 29 | 
             
                xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
         | 
| 31 30 | 
             
                android:layout_height="match_parent">
         | 
| @@ -36,9 +35,11 @@ | |
| 36 35 | 
             
                    android:text="遷移しました"/>
         | 
| 37 36 |  | 
| 38 37 | 
             
            </androidx.appcompat.widget.LinearLayoutCompat>
         | 
| 38 | 
            +
            ```
         | 
| 39 39 |  | 
| 40 | 
            +
             | 
| 40 41 | 
             
            ボタンを押して画面遷移する処理のみ
         | 
| 41 | 
            -
             | 
| 42 | 
            +
            ``` @Override
         | 
| 42 43 | 
             
                        public void onClick(View v) {
         | 
| 43 44 | 
             
                            FragmentManager fragmentManager = getFragmentManager();
         | 
| 44 45 | 
             
                            if(fragmentManager != null){
         | 
| @@ -47,6 +48,8 @@ | |
| 47 48 | 
             
                                fragmentTransaction.commit();
         | 
| 48 49 | 
             
                            }
         | 
| 49 50 | 
             
                        }
         | 
| 51 | 
            +
            ```
         | 
| 52 | 
            +
                       
         | 
| 50 53 |  | 
| 51 54 | 
             
            様々なサイト様を参考にしましたが、期待通りの結果になりませんでした。
         | 
| 52 55 | 
             
            かなり初歩的な問題かと思いますが、よろしくお願いします。
         | 
1
    
        title	
    CHANGED
    
    | 
            File without changes
         | 
    
        body	
    CHANGED
    
    | @@ -5,7 +5,7 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            ### 該当のソースコード
         | 
| 7 7 | 
             
            ・Fragment1のxml
         | 
| 8 | 
            -
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 8 | 
            +
            ```<?xml version="1.0" encoding="utf-8"?>
         | 
| 9 9 | 
             
            <androidx.appcompat.widget.LinearLayoutCompat
         | 
| 10 10 | 
             
                xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
         | 
| 11 11 | 
             
                android:layout_height="match_parent"
         | 
| @@ -20,7 +20,10 @@ | |
| 20 20 | 
             
                    android:text="Fragment2へ"/>
         | 
| 21 21 |  | 
| 22 22 | 
             
            </androidx.appcompat.widget.LinearLayoutCompat>
         | 
| 23 | 
            +
            コード
         | 
| 24 | 
            +
            ```
         | 
| 23 25 |  | 
| 26 | 
            +
             | 
| 24 27 | 
             
            ・遷移先Fragment2のxml
         | 
| 25 28 | 
             
            <?xml version="1.0" encoding="utf-8"?>
         | 
| 26 29 | 
             
            <androidx.appcompat.widget.LinearLayoutCompat
         | 
