Hi,

I'll describe my situation briefly. 

I have *main_actvity.xml *file which looks like this(just followed Android 
Devs guide): 


   1. <?xml version="1.0" encoding="utf-8"?>
   2. <RelativeLayout xmlns:android=
   "http://schemas.android.com/apk/res/android";
   3.     xmlns:tools="http://schemas.android.com/tools";
   4.     android:layout_width="match_parent"
   5.     android:layout_height="match_parent"
   6.     android:paddingBottom="@dimen/activity_vertical_margin"
   7.     android:paddingLeft="@dimen/activity_horizontal_margin"
   8.     android:paddingRight="@dimen/activity_horizontal_margin"
   9.     android:paddingTop="@dimen/activity_vertical_margin"
   10.     tools:context="com.example.ivan.fragmentsgameplay.MainActivity">
   11.  
   12.     <TextView
   13.         android:layout_width="wrap_content"
   14.         android:layout_height="wrap_content"
   15.         android:text="Hello World!" />
   16.  
   17.     <LinearLayout xmlns:android=
   "http://schemas.android.com/apk/res/android";
   18.         android:orientation="vertical"
   19.         android:layout_width="match_parent"
   20.         android:layout_height="match_parent">
   21.         <fragment android:name=
   "com.example.ivan.fragmentsgameplay.FragmentOne"
   22.             android:id="@+id/list"
   23.             android:layout_weight="1"
   24.             android:layout_width="match_parent"
   25.             android:layout_height="0dp" />
   26.         <fragment android:name=
   "com.example.ivan.fragmentsgameplay.FragmentTwo"
   27.             android:id="@+id/viewer"
   28.             android:layout_weight="2"
   29.             android:layout_width="match_parent"
   30.             android:layout_height="0dp" />
   31.     </LinearLayout>
   32. </RelativeLayout>
   

As you can see there are two fragments that are placed with 1/3 to 2/3 
ratio one above the other.

The problem is when I work separately on, say: *fragmentOne.xml* file (via 
Design bar in Android Studio. )
It shows me that this layout actually fills up all the screen space. 
So as far as can understand the final output layout will be dictated by 
*main_activity.xml* and all the great stuff that I would add to 
*fragmentOne.xml* will be resized in order to fit onto screen. 

My question is about* fragmentOne.xml *(and fragmentTwo.xml too ^_^) is 
there some good way to change this xml file in such a manner that the 
fragment's layout will be presented in accordance with a proportions 
defined 
at *main_activity.xml*? 

I mean in such case I'll be able to work within a dimensions that will be 
actually presented to user, and will place all the elements (inside 
fragmentOne layout) in a proper way. 

Without having a headache of rearranging those elements afterwards due to 
re-sizing of *main_activity.xml.* 

An example of my *fragmentOne.xml *file(just some dumb layout having a 
single button):

   1. <FrameLayout xmlns:android=
   "http://schemas.android.com/apk/res/android";
   2.     xmlns:tools="http://schemas.android.com/tools";
   3.     android:layout_width="match_parent"
   4.     android:layout_height="match_parent"
   5.     tools:context="com.example.ivan.fragmentsgameplay.FragmentOne"
   6.     android:background="#323b8a">
   7.  
   8.    
   9.  
   10.     <Button 
   
<http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+button>
   11.         android:layout_width="wrap_content"
   12.         android:layout_height="wrap_content"
   13.         android:id="@+id/frag_one_button"
   14.         android:layout_gravity="center_horizontal|top"
   15.         android:textAllCaps="true"
   16.         android:text="Go To Fragment Two" />
   17. </FrameLayout>
   

Thanks a lot for help  (hope my question was clear ^_^, and yes I'm an 
Android newbie).

-- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/android-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-developers/fed5cc7b-4b76-4122-9fb7-d8a06490cf84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to