What is the equivalent code for android: layout_above = "@android: id / tabs"?

I created TabWidget

TabWidget tabWidget = new TabWidget(this);
        tabWidget.setId(android.R.id.tabs);

and framelayout

FrameLayout frameLayout = new FrameLayout(this);
        frameLayout.setId(android.R.id.tabcontent);

how to make framelayout over tabs?

**what is the equivalent code to "android:layout_above="@android:id/tabs"**

EDIT

I am doing with this code, is this correct?

TabHost tabHost = new TabHost(this);
tabHost.setLayoutParams(
                new RelativeLayout.LayoutParams(
                        LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT,1));
 TabWidget tabWidget = new TabWidget(this);
        tabWidget.setId(android.R.id.tabs);

RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(width, height);
lp.addRule(RelativeLayout.ABOVE, R.id.tabcontent);
tabWidget.setLayoutParams(lp);

tabHost.addView(tabWidget);
FrameLayout frameLayout = new FrameLayout(this);
        frameLayout.setId(android.R.id.tabcontent);
        frameLayout.setPadding(0, 55, 0, 0);
tabHost.addView(frameLayout, new RelativeLayout.LayoutParams(
                  LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); 
tabHost.setup();
+3
source share
1 answer
RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(width, height);
lp.addRule(RelativeLayout.ABOVE, R.id.tabcontent);
tabWidget.setLayoutParams(lp);
+5
source

Source: https://habr.com/ru/post/1775903/


All Articles