Fragment not being replaced correctly - android

I created an activity with a navigation drawer and a FrameLayout. This frame layout should contain the fragment which corresponds the selected navigation item. So I followed the instructions in android tutorials, but it doesn't work.
Problem:
It seems to me the fragments are only added and not replaced. What am I doing wrong?
My activity xml:
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mainViewDrawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<FrameLayout
android:id="#+id/mainViewContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="#dimen/drawer_content_padding" >
</FrameLayout>
<ListView android:id="#+id/mainViewDrawerList"
android:layout_width="#dimen/drawer_size"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="none"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:background="#color/drawer_background"
/>
</android.support.v4.widget.DrawerLayout>
my first fragment xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingLeft="#dimen/activity_vertical_margin"
android:paddingRight="#dimen/activity_vertical_margin"
android:paddingTop="#dimen/activity_horizontal_margin"
android:paddingBottom="#dimen/activity_horizontal_margin"
android:id="#id/fragmentProfile">
<TextView
style="#android:style/TextAppearance.Small"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/mainViewProfileGivenNameLabel"
/>
<TextView
android:id="#+id/profileGivenNameTextView"
style="#android:style/TextAppearance.Large"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
</LinearLayout>
my second fragment xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="#id/fragmentProtocol">
<ListView android:id="#+id/protocolTableListView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:transcriptMode="alwaysScroll"
android:cacheColorHint="#00000000"
android:listSelector="#android:color/transparent"/>
</LinearLayout>
my transition method in the activity:
private void switchToFragment(int navigationId, boolean addToBackStack){
FragmentManager fragmentManager = getFragmentManager();
String fragmentTag = null;
boolean fragmentCreated = false;
switch(navigationId) {
case NavigationItemProvider.NAVIGATIONITEM_PROFILE:
fragmentTag = NAVIGATIONTAG_PROFILE;
break;
case NavigationItemProvider.NAVIGATIONITEM_PROTOCOL:
fragmentTag = NAVIGATIONTAG_PROTOCOL;
break;
}
// determine if the fragment is already instanciated otherwise create
FragmentBase fragment = (FragmentBase)fragmentManager.findFragmentByTag(fragmentTag);
if (fragment == null){
if (fragmentTag == NAVIGATIONTAG_PROFILE) {
fragment = new ProfileFragment();
fragmentCreated = true;
}
else if(fragmentTag == NAVIGATIONTAG_PROTOCOL) {
fragment = new ProtocolFragment();
fragmentCreated = true;
}
}
// switch to fragment
if (fragment.isVisible()){
return;
}
FragmentTransaction transaction = fragmentManager.beginTransaction();
if (fragmentCreated) {
transaction.replace(R.id.mainViewContentFrame, fragment, fragmentTag);
}
else{
transaction.show(fragment);
}
if(addToBackStack)
{
transaction.addToBackStack(null);
}
transaction.commit();
}

solved the problem:
In onCreate I returned the result of super.onCreate and not the result of Layoutinfalter.inflate and in addition I didn't call inflate with last parameter set to false.

Related

Replacing a single fragment with multiple fragments

I have one activity (Navigation Controller) that controls multiple fragments. The initial screen the user sees is a single fragment placed into one container. When I click a button to a different fragment I need to add the first fragment to the backstack and add the two new fragments to different containers than the first one. The two fragments are a map fragment on top and a profile details fragment on the bottom Is this even possible?
The code is below.
Navigation Controller Home Fragment (this is the main screen when the app starts):
public void home(Bundle savedInstanceState){
FragmentManager fm = getFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
if (findViewById(R.id.fragment_container) != null) {
if (savedInstanceState != null) {
return;
}
// Create a new Fragment to be placed in the activity layout
CurrentFriendsFragment firstFragment = new CurrentFriendsFragment();
// Add the fragment to the 'fragment_container' FrameLayout
fragmentTransaction
.setCustomAnimations(R.animator.fade_in, R.animator.fade_out)
.replace(R.id.fragment_container, firstFragment, "firstFragment")
.commit();
}
}
Navigation Controller Profile Fragment:
#Override
public void onProfileButtonClicked() {
FragmentManager fm = getFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
if (findViewById(R.id.fragment_container) != null) {
if (savedInstanceState1 != null) {
return;
}
MapFragment mapFragment = new MapFragment();
// Create a new Fragment to be placed in the activity layout
ProfileFragment profileFragment = new ProfileFragment();
// Add the fragment to the 'fragment_container' FrameLayout
fragmentTransaction
.setCustomAnimations(R.animator.slide_in_up, R.animator.slide_out_up, R.animator.slide_in_down, R.animator.slide_out_down)
.add(R.id.fragment_container_bottom_large, profileFragment)
.add(R.id.fragment_container_top_small, mapFragment)
.commit();
}
}
And here is the main activities xml file. Note the three different containers. "fragment_container" for full screen fragments, and "fragment_container_top_small", "fragment_container_bottom_large" for multiple fragments on one page.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/activity_navigation"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.parse.starter.ViewControllers.NavigationController"
android:background="#color/palette_darkwhite">
<include layout="#layout/tool_bar"
android:id="#+id/toolbar_layout" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:layout_below="#+id/toolbar_layout"
android:layout_above="#+id/bottom_navigation_navbar">
<RelativeLayout
android:id="#+id/fragment_container_top_small"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1">
</RelativeLayout>
<FrameLayout
android:id="#+id/fragment_container_bottom_large"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="3">
</FrameLayout>
</LinearLayout>
<FrameLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#+id/toolbar_layout"
android:layout_above="#+id/bottom_navigation_navbar">
</FrameLayout>
<FrameLayout
android:id="#+id/fragment_container_popup"
android:layout_width="275dp"
android:layout_height="275dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true">
</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottom_navigation_navbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#color/palette_lightwhite">
<ImageView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_gravity="center_horizontal"
android:background="#null"
app:srcCompat="#drawable/collpaseup" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical">
<LinearLayout android:id="#+id/thumbnail2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:layout_alignParentLeft="true"
android:layout_marginRight="5dp">
<de.hdodenhof.circleimageview.CircleImageView
android:id="#+id/profile_picture_navbar"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
app:civ_border_color="#FF000000"/>
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/thumbnail2"
android:layout_toRightOf="#+id/thumbnail2"
android:textColor="#color/palette_primarycolor"
android:id="#+id/nameLabel"
android:text="Name"
android:textSize="15sp"
android:textStyle="bold"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/nameLabel"
android:layout_toRightOf="#+id/thumbnail2"
android:textColor="#color/palette_primarycolor"
android:id="#+id/locationLabel"
android:text="Location"
android:textSize="12sp"
android:textStyle="bold"/>
</RelativeLayout>
</android.support.design.widget.BottomNavigationView>
</RelativeLayout>
Have 3 containers and use View.GONE to make the 1st disappear and then View.VISIBLE to make the other 2 appear.

I want to replace fragment but its add after previous fragment

I want to replace fragment but android app add new fragment after first fragment instead of replace fragment. And after that when i try to replace again app replace with fragment which one is added after first fragment. First fragment which was loaded on activity, remain static. Can any body help? I am using this code to replace fragment.
Fragment fr = fragment;
FragmentManager fm = getSupportFragmentManager();
FragmentTransaction ft = fm.beginTransaction();
ft.replace(R.id.frgRemote, fr);
ft.commit();
<RelativeLayout 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"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.cerad.home.automation.RoomsActivity$PlaceholderFragment" >
<LinearLayout
android:id="#+id/lytHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/lytCamcontroller"
android:orientation="vertical" >
<TextView
android:id="#+id/tvHeading"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium" />
<ImageView
android:id="#+id/stream_image"
android:layout_width="640px"
android:layout_height="480px"
android:layout_gravity="center_horizontal"
android:layout_margin="5dp"
android:background="#drawable/border"
android:contentDescription="#string/image_descriptor_video_streaming" />
<ScrollView
android:id="#id/lytCommandnControl"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<fragment
android:id="#+id/frgRemote"
android:name="com.cerad.automation.DefaultRemoteFragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<TableLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TableRow
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >
<Button
android:id="#+id/btnTVRemote"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/button_tv_remote" />
<Button
android:id="#+id/btnDefault"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:checked="true"
android:text="#string/button_default_control" />
<Button
android:id="#+id/btnACRemote"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="#string/button_ac_remote" />
</TableRow>
</TableLayout>
</ScrollView>
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
I have three fragments, i replace like this:
private void displayView(int position) {
Fragment fragment = null;
switch (position) {
case 0:
fragment = new HomeFragment();
break;
case 1:
fragment = new AlterFragment();
break;
case 2:
fragment = new ExtraFragment();
break;
default:
break;
}
if (fragment != null) {
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction().replace(R.id.frame_container, fragment).commit();
mDrawerList.setItemChecked(position, true);
mDrawerList.setSelection(position);
setTitle(navMenuTitles[position]);
mDrawerLayout.closeDrawer(mDrawerList);
}
else {
}
}
You might want to re-read the documentation for FragmentTransaction.replace():
The first argument to replace(int containerViewId, Fragment fragment) is not the ID of the fragment's view, but the ID of the container of the fragment. Hence your call adds a new nested fragment (of the same type) inside the fragment view wrapper of the already existing fragment.
From FragmentTransaction.replace(id, frag, tag)'s documentation:
This is essentially the same as calling remove(Fragment) for all currently added fragments that were added with the same containerViewId and then add(int, Fragment, String) with the same arguments given here.
To fix this, you must give an ID to the LinearLayout containing your fragment, e.g.
<LinearLayout
android:id="#+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
and call replace() with the ID of the container.
ft.replace(R.id.fragment_container, fr);
It is also good practice to always assign unique tags to pre-defined fragments:
<fragment
android:id="#+id/frgRemote"
android:name="com.cerad.automation.DefaultRemoteFragment"
android:tag="remote_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
So that you can address multiple fragments by their unique tags, if necessary
ft.replace(R.id.fragment_container, fr, "remote_fragment");

IllegalArgumentException: No view found for id for fragment

I am getting
11-13 java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.makemyday/com.example.makemyday.ActionDetailActivity}:java.lang.IllegalArgumentException: No view found for id 0x7f050007 (com.example.makemyday:id/action_detail_container) for fragment ActionDetailFragment{41e9add8 #0 id=0x7f050007}
Code for action_detail_activity
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_action_detail);
if (savedInstanceState == null) {
Bundle arguments = new Bundle();
String id= getIntent().getStringExtra(ActionDetailFragment.ARG_ITEM_ID);
arguments.putString(ActionDetailFragment.ARG_ITEM_ID, id);
ActionDetailFragment fragment = new ActionDetailFragment();
fragment.setArguments(arguments);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.action_detail_container, fragment);
SupportMapFragment mapFragment;
ImageFragment imageFragment;
Toast.makeText(this, ActionDetailFragment.ARG_ITEM_ID, Toast.LENGTH_SHORT).show();
if(id.equalsIgnoreCase("1"))
{
Toast.makeText(this, "here1", Toast.LENGTH_SHORT).show();
//mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
//map=mapFragment.getMap();
}
else if(id.equalsIgnoreCase("2"))
{
Toast.makeText(this, "here2", Toast.LENGTH_SHORT).show();
//imageFragment = (ImageFragment) getSupportFragmentManager().findFragmentById(R.id.picture_upload);
imageFragment=new ImageFragment();
ft.add(R.id.imageContainer, imageFragment);
}
ft.commit();
}
}
Code for activity_action_detail.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+android:id/outer_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".ItemDetailActivity"
tools:ignore="MergeRootFrame">
<FrameLayout
android:id="#+android:id/action_detail_container"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="#+android:id/imageContainer"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<Button
android:id="#+id/start_time_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="from" />
</LinearLayout>
Please can someone answer this
Try this..
No need to use #+android:id for framelayout only
fragement listview need #+android:id
for linearlayout also use
android:id="#+id/outer_container"
and
<FrameLayout
android:id="#+id/action_detail_container"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
<FrameLayout
android:id="#+id/imageContainer"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
EDIT:
#+android:id means you are referring to an FrameLayout defined in the android namespace. #+id defining your own Id to a view.
Very Good..This saved me too..
android:id="#+id/container"
was missing in my code.

Why findFragmentById returns the old fragment was in before the call to replace FragmentLayout?

Why after changing fragments from the first(pageNews) to the second(pageViewFromWeb) "findFragmentById" returns a reference to the first(pageNews) fragment?
layout:
<RelativeLayout 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"
tools:context=".MainActivity"
android:paddingTop="10dp"
android:background="#000">
<FrameLayout
android:id="#+id/frgmCont"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000">
</FrameLayout>
</RelativeLayout>
code:
fTrans = getSupportFragmentManager().beginTransaction();
fTrans.add(R.id.frgmCont, pageNews);
....
....
public void selectNews(String news_id) {
// Toast.makeText(this, news_id, Toast.LENGTH_SHORT).show();
fTrans = getSupportFragmentManager().beginTransaction();
fTrans.replace(R.id.frgmCont, pageViewFromWeb);
fTrans.commit();
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.frgmCont);
...
}
Its because replace() does not execute immediately, but the FragmentTransaction is scheduled. When you findFragmentById() immediately after replacing fragments, they are not replaced yet...

FragmentTabHost doesn't show tab content

I have an application witch contains a drawer menu for navigation and a fragment activity in which a fragment is shown depending on the drawer selection. Now I have 2 fragments, a simple one (SettingsFragment) and one containing a FragmentTabHost (SearchFragment). The with the FragmentTabHost is displayed when the application is opened. The problem is that if I switch between fragments - go to the Settings Fragment then back to SearchFragment then the tabhost's content is not displayed anymore (the onCreateView of the fragment contained in the first tab is not called) unless I switch between tabs.
So I change between fragments using replace in my activity:
public void replaceRightFragment(int fragmentId) {
Fragment newFragment = null;
switch (fragmentId) {
case FRAGMENT_SEARCH_PROPERTY:
newFragment = getSupportFragmentManager().findFragmentByTag(SearchPropertyFragment.class.getSimpleName());
if (newFragment == null) {
newFragment = new SearchPropertyFragment();
}
break;
case FRAGMENT_SETTINGS:
newFragment = getSupportFragmentManager().findFragmentByTag(SettingsFragment.class.getSimpleName());
if (newFragment == null) {
newFragment = new SettingsFragment();
}
break;
}
if (newFragment != null) {
if (!newFragment.isVisible()) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
// Replace whatever is in the fragment_container view with this fragment,
// and add the transaction to the back stack
fragmentTransaction.replace(R.id.main_view, newFragment, newFragment.getClass().getSimpleName());
// fragmentTransaction.remove(mainFragment);
// fragmentTransaction.add(R.id.main_view, newFragment, newFragment.getClass().getSimpleName());
// fragmentTransaction.addToBackStack(null);
// Commit the transaction
fragmentTransaction.commitAllowingStateLoss();
}
hideSlideMenu();
hideKeyboard();
}
}
My tabhost layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
>
<include layout="#layout/header_bar"/>
<android.support.v4.app.FragmentTabHost
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TabWidget
android:id="#android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:orientation="horizontal"
/>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="0"
/>
<FrameLayout
android:id="#+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
/>
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
</LinearLayout>
... and tabhost setup in fragment:
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_search_property,
container, false);
mTabHost = (FragmentTabHost) view.findViewById(android.R.id.tabhost);
mTabHost.setup(getActivity(),
getActivity().getSupportFragmentManager(), R.id.realtabcontent);
mTabHost.addTab(
mTabHost.newTabSpec(SELL_FRAGMENT_TAG).setIndicator(
getString(R.string.search_property_sell_tab_title)),
SearchPropertySellFragmentTab.class, null);
mTabHost.addTab(
mTabHost.newTabSpec(RENT_FRAGMENT_TAG).setIndicator(
getString(R.string.search_property_rent_tab_title)),
SearchPropertyRentFragmentTab.class, null);
mTabHost.addTab(
mTabHost.newTabSpec(ADD_ADVERT_FRAGMENT_TAG).setIndicator(
getString(R.string.search_property_add_tab_title)),
SearchPropertyAddAdvertFragmentTab.class, null);
ImageButton mDrawerButton = (ImageButton) view.findViewById(R.id.drawer_button);
mDrawerButton.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
((DrawerMenuController) getActivity()).onDrawerButtonPressed();
// if (mDrawerLayout.isDrawerOpen(mDrawerList)) {
// mDrawerLayout.closeDrawer(mDrawerList);
// } else {
// mDrawerLayout.openDrawer(mDrawerList);
// }
}
});
mTabHost.onTabChanged(SELL_FRAGMENT_TAG);
mTabHost.setOnTabChangedListener(this);
return view;
}
#Override
public void onDestroyView() {
super.onDestroyView();
mTabHost.removeAllViews();
mTabHost = null;
}
Any hints?
DO NOT need the TabWidget, FragmentTabHost will add it automaticly.
Put this wedgit above the realtabcontent, if you want the tabs to be at the top!
but you can customise it like this as i did...
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
android:id="#+id/realtabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#android:id/tabhost" />
<FrameLayout
android:id="#+id/homeContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="#android:id/tabhost"
android:layout_marginTop="#dimen/button_height"
android:background="#ffffff"
android:visibility="gone" >
</FrameLayout>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:background="#ffffff"
android:orientation="horizontal" >
<ImageView
android:id="#+id/btn_homeScreen_tab"
android:layout_width="#dimen/button_height"
android:layout_height="#dimen/button_height"
android:layout_alignParentLeft="true"
android:src="#drawable/grange_logo" />
<android.support.v4.app.FragmentTabHost
android:id="#android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_marginLeft="#dimen/button_height"
android:layout_marginRight="#dimen/button_height" />
<ImageView
android:id="#+id/ph_lable_title"
android:layout_width="#dimen/button_height"
android:layout_height="#dimen/button_height"
android:layout_alignParentRight="true"
android:src="#drawable/contact_1" />
</RelativeLayout>

Categories

Resources