instances画面、characters画面への遷移、移動 #12

Merged a-matsumoto merged 1 commit into nitta-lab-2018:master from nitta-lab-2018:Test on 14 Jun 2018
Showing 4 changed files
View
37
app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/views/CharactersFragment.java 0 → 100644
package org.ntlab.radishforandroidstudio.cactusClient.views;
 
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.app.Fragment;
import android.widget.Button;
 
 
import org.ntlab.radishforandroidstudio.R;
 
public class CharactersFragment extends Fragment {
 
public void onStart() {
super.onStart();
 
Button button = (Button) getActivity().findViewById(R.id.chooseInstances);
//↓↓↓↓↓↓↓↓画面遷移↓↓↓↓↓↓↓↓
button.setOnClickListener(new View.OnClickListener() {
 
@Override
public void onClick(View v) {
//Toast.makeText(getActivity(), "hoge!", Toast.LENGTH_SHORT).show();
 
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
 
transaction.replace(R.id.fragment_place, new InstancesFragment());
 
transaction.commit();
}
});
}
}
View
34
app/src/main/java/org/ntlab/radishforandroidstudio/cactusClient/views/InstancesFragment.java
package org.ntlab.radishforandroidstudio.cactusClient.views;
 
 
import android.accounts.Account;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.v4.app.Fragment;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
 
 
 
import org.ntlab.radishforandroidstudio.R;
 
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.instances_fragment, container, false);
}
 
public void onStart() {
super.onStart();
 
Button button = (Button) getActivity().findViewById(R.id.Instance1);
//↓↓↓↓↓↓↓↓画面遷移↓↓↓↓↓↓↓↓
button.setOnClickListener(new View.OnClickListener() {
 
@Override
public void onClick(View v) {
//Toast.makeText(getActivity(), "hoge!", Toast.LENGTH_SHORT).show();
 
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
 
transaction.replace(R.id.fragment_place, new CharactersFragment());
 
transaction.commit();
}
});
}
}
View
39
app/src/main/res/layout/characters_fragment.xml 0 → 100644
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
 
<Button
android:id="@+id/chooseInstances"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="ワールド選択へ"
tools:layout_editor_absoluteX="148dp"
tools:layout_editor_absoluteY="367dp" />
 
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Jyaian"
tools:layout_editor_absoluteX="148dp"
tools:layout_editor_absoluteY="218dp" />
 
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="DORAEMON"
tools:layout_editor_absoluteX="266dp"
tools:layout_editor_absoluteY="218dp" />
 
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Nobita"
tools:layout_editor_absoluteX="27dp"
tools:layout_editor_absoluteY="218dp" />
</android.support.constraint.ConstraintLayout>
View
app/src/main/res/layout/instances_fragment.xml