Easy. Just use fragments! With fragments, you will have complete control of size and location of everything. See my example
Here is my main xml. This is two separate fragments. Each takes up about a quarter of the screen.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:padding="12dp">
<fragment
android:name="com.diamond.home.fragments.TopFragment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<!-----here, add the rest of your xml for your main activity -------->
Your main activity that will display these fragments will not need to do anything to display your fragments because your XML will already call the fragments in for you. NOTE: if you want to display the fragment only at certain times, you can reference the fragment
from the xml, and set the visibility to GONE. Then when you need it, set it to VISIBLE.
Then, Create fragment classes like so:
public class TopFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragments_top, container, false);
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
//do your stuff for your fragment here
}
So you will also need to create another xml layout for your top-fragment. In that, you can add buttons, text views or what have you. Hope this helps. If you have any questions, feel free to ask.