Hello I have an surfaceview in my app.All my games are built like this:
Instanciating a subclass of Surfaceview which implements the SurfaceHolder.Callback interface.
Now is that I want to open a menu when I click on a Button(custom made object) This should bring up a fragment with a scrollable textview( I thought of just a listview with one textview element inside it because I think the textview alone is not scrollable if the text is very long..any contrary arguments are welcome)
but how do I do this?
I have allready a Fragment class and a layout for the fragment
Edit 3:
Ok I've managed to set the SurfaceView programmatically like this:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if(savedInstanceState==null)
{
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
prefs=getSharedPreferences("myPrefs",0);
mView=new MainView(this);
loadSharedPrefs();
LinearLayout myLayout = (LinearLayout)findViewById(R.id.main);
mView.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
myLayout.addView(mView);
}
}
where the layout is just a blank linearlayout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:id="@+id/main">
</LinearLayout>
So for now I just need a Fragment to be displayed when I click a Button
Here the Fragment Class so far:
public class HintListFragment extends Fragment
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.hintlist, container, false);
}
}
and the layout for this fragment:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/hintList"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="sagdjsahgdhascxasbcxahsgdhsagdhasgdashgdsajsgdh"
/>
</LinearLayout>