2

So I need the view of my settings to display over my main page.where there is a "setting"button in Main page which opens this settings view. But I want My main page to be visible beneath my settings view which only covers a half or less of the main view.

I tried adding

<org.example.myCustomView 
    xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_width="fill_parent"  
    android:layout_height="fill_parent"  
    android:theme="@android:style/Theme.Dialog" />

Which I found from stackoverflaw itself. But I cannot do it instead the application corrupts at button click.

I am not sure I got this too correct, Or is there any other clear way to do it? I replaced myCustomView with my relevent class and created the manifest also but it did not work.

If there is any other alternative way to do this mention to me.

I am not talking about how to place a TextView, Button, EditText on a view

I am talking about completely two layouts.

Below image is only an example to express my question.

enter image description here

Community
  • 1
  • 1
SMK
  • 324
  • 3
  • 14
  • use a pop menu or a you can put those items in actionbar. http://developer.android.com/guide/topics/ui/actionbar.html – Raghunandan May 18 '14 at 15:30

3 Answers3

1

I think you need to utilize layoutinflater. Here is a simple example how to use it

     setContentView(R.layout.yourMainView);
     LayoutInflater mInflater = LayoutInflater.from(getApplicationContext());
     View overView = mInflater.inflate(R.layout.yourSmallView, null);
     addContentView(overView, new LayoutParams(LayoutParams.MATCH_PARENT, 
            LayoutParams.MATCH_PARENT));
Amrmsmb
  • 1
  • 27
  • 104
  • 226
1

Use FrameLayout.FrameLayout is like container.In it place first your bluelayout and then your settings layout.It will show as if settings layout is placed on top of your blue layout. and then hide and show your settings layout on the onclick when required. eg:

Mansi Salvi
  • 247
  • 1
  • 7
  • if anyone use this answer this link may also help http://blog.neteril.org/blog/2013/10/10/framelayout-your-best-ui-friend/ – SMK May 27 '14 at 09:38
0

You could use a Dialog Fragment which would be much more simpler and show more complicated stuff on UI with better responsiveness. Have a look at Dialog fragment: http://developer.android.com/reference/android/app/DialogFragment.html

zIronManBox
  • 4,967
  • 6
  • 19
  • 35