Android studio frame layout not showing up in activity_main - java

I'm trying to design my on tabsView, so I created framelayout,called view_tabs.xml,with all the buttons and with background and everything else and its preview looks fine, then I created class for this tabLayout called: TabsView, in which I inflated that framelayout, I connected all ImageViews to their id's and tried to add this view to activity_main.xml but when I add it I see only shape of this layout, there are no button images, no background, nothing at all.
Here's view_tabs.xml
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/homeTabsViewFrame"
android:layout_width="match_parent"
android:layout_height="80dp"
xmlns:tools="http://schemas.android.com/tools"
tools:layout_gravity="bottom"
tools:background="#color/light_red">
<ImageView
android:id="#+id/vst_center_image"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center|bottom"
android:background="#drawable/ic_launcher"
android:layout_marginBottom="10dp"/>
<ImageView
android:id="#+id/vst_start_image"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_marginStart="24dp"
android:layout_gravity="start|bottom"
android:background="#drawable/gpsmapbutton"
android:layout_marginBottom="10dp"/>
<ImageView
android:id="#+id/vst_end_image"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="end|bottom"
android:layout_marginEnd="24dp"
android:background="#drawable/icon_black"
android:layout_marginBottom="10dp"/>
<View
android:id="#+id/vst_indicator"
android:layout_width="64dp"
android:layout_height="5dp"
android:layout_gravity="bottom|center"
android:layout_marginBottom="4dp"
android:background="#color/white"/>
</FrameLayout>
Here's TabsView.java
package com.hist_area.imeda.histarea.view;
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView;
import com.hist_area.imeda.histarea.R;
/**
* Created by imeda on 8/16/17.
*/
public class TabsView extends FrameLayout implements ViewPager.OnPageChangeListener {
private ImageView mCenterImage;
private ImageView mStartImage;
private ImageView mEndImage;
private View mIndicator;
public TabsView(Context context) {
this(context, null);
}
public TabsView(Context context, AttributeSet attrs) {
this(context, attrs,0);
}
public TabsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
private void init() {
LayoutInflater.from(getContext()).inflate(R.layout.view_tabs,this,true);
mCenterImage = (ImageView) findViewById(R.id.vst_center_image);
mStartImage = (ImageView) findViewById(R.id.vst_start_image);
mEndImage = (ImageView) findViewById(R.id.vst_end_image);
mIndicator = (View) findViewById(R.id.vst_indicator);
}
#Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
#Override
public void onPageSelected(int position) {
}
#Override
public void onPageScrollStateChanged(int state) {
}
}
and Here's activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:background="#color/black"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hist_area.imeda.histarea.MainActivity">
<View
android:id="#+id/home_tabs_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lignt_blue"
android:alpha="0.5"/>
<android.support.v4.view.ViewPager
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.hist_area.imeda.histarea.view.TabsView
android:id="#+id/homeTabsView"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_alignParentBottom="true"/>
</RelativeLayout>

i dont understand, but, Why not use 'include' tag?

Related

Image is visible but text is not visible in ListView

I am trying to create a custom layout for list view in android studio. I was able to successfully get image in the in ListView on runtime but wasn't able to print text in the list view . When i run my program in emulator it runs without any error but it doesn't show any text it only shows image from drawables.
MainActivity.java
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;
public class MainActivity extends AppCompatActivity {
private final static String[] names={"A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A","A",
"A","A","A","A","A","A","A","A","A","A","A","A","A","A",};
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ListView ls = findViewById((R.id.customlistview));
ls.setAdapter(new CustomListAdapter(getApplicationContext(),names,R.drawable.za));
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout 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:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<ListView
android:id="#+id/customlistview"
android:layout_width="409dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="1dp"
android:layout_marginBottom="1dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
CustomListAdapter.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;
public class CustomListAdapter extends BaseAdapter {
private final Context context;
private final String[] names;
private final int image;
private final LayoutInflater layoutInflater;
public CustomListAdapter(Context context,String[] names,int image) {
this.context=context;
this.image=image;
this.names=names;
layoutInflater= (LayoutInflater) this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
#Override
public int getCount() {
return names.length;
}
#Override
public Object getItem(int position) {
return position;
}
#Override
public long getItemId(int position) {
return position;
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View rootview;
rootview = layoutInflater.inflate(R.layout.list_item_layout, null);
TextView tv= rootview.findViewById(R.id.textView);
ImageView iv=rootview.findViewById(R.id.imageView);
tv.setText(names[position]);
iv.setImageResource(image);
return rootview;
}
}
list_item_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:id="#+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:height="70dp"
android:gravity="center"
android:text="TextView"
android:textSize="18sp" />
<ImageView
android:id="#+id/imageView"
android:layout_width="match_parent"
android:layout_height="70dp"
android:layout_weight="2"
app:srcCompat="#mipmap/ic_launcher" />
</LinearLayout>
The issue is in your list_item_layout file. There is an issue with match_parent in your layout try using below code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:weightSum="3"
android:orientation="horizontal">
<TextView
android:id="#+id/textView"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:height="70dp"
android:gravity="center"
android:text="TextView"
android:textSize="18sp" />
<ImageView
android:id="#+id/imageView"
android:layout_width="0dp"
android:layout_height="70dp"
android:layout_weight="2"
app:srcCompat="#mipmap/ic_launcher" />
The problem was caused by the text colour , changing the colour of textview text in list_item_layout resolved the issue.

How to Resize the toolbar according to the length of the title?

According to the fragment in which I am setting the title of my Toolbar, but some titles are very long and the App puts three points:
What I want is to display the full title, not decrease the size of the letter, if not increase the size of the toolbar so that if the title does not reach in a line that is put in a second as if it were a wrapcontent.
How is it possible to do this?
My toolbar in XML:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:id="#+id/toolbar"
android:layout_height="?attr/actionBarSize"
android:theme="#style/Toolbar" />
</LinearLayout>
Setting the title via Java
((NavigationDrawerActivity) activity)
.getSupportActionBar().setTitle(mytext);
I have developed a custom toolbar that tries to fit text as much as possible. You should set this custom Toolbar as action bar like this: https://developer.android.com/training/appbar/setting-up.
Here is my custom toolbar code:
MyToolbar.java:
package com.aminography.textapp;
import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.Toolbar;
import android.util.AttributeSet;
import android.view.LayoutInflater;
public class MyToolbar extends Toolbar {
private AppCompatTextView mTitleTextView;
public MyToolbar(Context context) {
super(context);
mTitleTextView = LayoutInflater.from(context).inflate(R.layout.toolbar_title_layout, this).findViewById(R.id.titleTextView);
addView(mTitleTextView);
}
public MyToolbar(Context context, #Nullable AttributeSet attrs) {
super(context, attrs);
mTitleTextView = LayoutInflater.from(context).inflate(R.layout.toolbar_title_layout, this).findViewById(R.id.titleTextView);
addView(mTitleTextView);
}
public MyToolbar(Context context, #Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
mTitleTextView = LayoutInflater.from(context).inflate(R.layout.toolbar_title_layout, this).findViewById(R.id.titleTextView);
addView(mTitleTextView);
}
#Override
public void setTitle(int resId) {
mTitleTextView.setText(resId);
}
#Override
public void setTitle(CharSequence title) {
mTitleTextView.setText(title);
}
#Override
public void setTitleTextColor(int color) {
mTitleTextView.setTextColor(color);
}
}
toolbar_title_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="16dp"
android:paddingRight="16dp">
<android.support.v7.widget.AppCompatTextView
android:id="#+id/titleTextView"
style="#style/TextAppearance.AppCompat.Widget.ActionBar.Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:autoSizeMinTextSize="9sp"
app:autoSizeStepGranularity="0.5sp"
app:autoSizeTextType="uniform" />
</FrameLayout>

Page View inside Scroll View in Fragment Android

I have an android fragment layout,I want to put my page view inside the scroll view. When app running without scroll view the image it's showing but when I put the page view code inside the scroll view the image it's not showing.
Here is my code
<LinearLayout 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="com.example.wk.sigah.FragmentHome"
android:background="#color/colorPrimary">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.view.ViewPager
android:id="#+id/viewImage"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</android.support.v4.view.ViewPager>
</ScrollView>
</LinearLayout>
Override onMeasure in class and extends ViewPager as follows, this
will make it get the height of the biggest child it currently has.
import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.View;
public class CustomViewPager extends ViewPager {
public CustomViewPager(Context context) {
super(context);
}
public CustomViewPager(Context context, AttributeSet attrs){
super(context, attrs);
}
#Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
int height = 0;
for(int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
int h = child.getMeasuredHeight();
if(h > height) height = h;
}
heightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
In XML :
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:fillViewport="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.your.package.name.CustomViewPager
android:id="#+id/viewImage"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
Tutorial

My TextView Doesn't Seen

I want to see on the screen a Button object, a TextView object and a MyView object. But only appear Button object and MyVıew object. I think , MyView overlapping(above the TextView) with TextView. Because If I don't add(b.addView(a);)MyView object to my layout, Button and TextView objects appear on the screen. But If I add(b.addView(a);) MyView , TextView is gone. How can I solve this problem?
MyView.java file:
package com.example.mehmet.catchtheball;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.View;
public class MyView extends View {
public MyView(Context context) {
super(context);
}
#Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
Paint paint = new Paint();
paint.setColor(Color.WHITE);
canvas.drawPaint(paint);
paint.setColor(Color.parseColor("lightGray"));
canvas.drawCircle(500, 500, 150, paint);
}
public MyView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public MyView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
}
Customer.java file :
package com.example.mehmet.catchtheball;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
public class Customer extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_customer);
MyView a = new MyView(this);
RelativeLayout b = (RelativeLayout)findViewById(R.id.relativeLayout);
b.addView(a); // If I do this , TextView gone.
final TextView label = (TextView) findViewById(R.id.textView3);
label.setText("HelloEveryOne"); // My TextView
a.setOnTouchListener(new View.OnTouchListener() {
public boolean onTouch(View view, MotionEvent motionEvent) {
return true;
}
});
}
}
activity_customer.xml file :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.mehmet.catchtheball.main">
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:onClick="undo"
android:text="#string/undo" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="27dp"
android:layout_marginStart="27dp"
tools:textColor="#android:color/background_dark" />
</RelativeLayout>
Try with this activity_customer.xml:
<?xml version="1.0" encoding="utf-8"?>
<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="com.example.mehmet.catchtheball.main">
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:onClick="undo"
android:text="#string/undo" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/button"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="27dp"
android:layout_marginStart="27dp"
tools:textColor="#android:color/background_dark" />
</RelativeLayout>
Add a LinearLayout as container below textView3 and add all to then
In the XML here you posted, add a with layout_belowOf=textView3, at your code where you do b.addView(a) replace with: LinearLayout c = findViewById(R.id.ll_c_container) and c.addView(a)
If you want to all components to be in an linear axis you can have just one linearlayout (all addViews will add below the last view)
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:onClick="undo"
android:text="#string/undo" />
<TextView
android:id="#+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_below="#+id/button"
android:layout_marginStart="27dp" />
</RelativeLayout>
In your java class just do this one (Sorry i am writing kotlin code
MyView a = new MyView(this);
val params = RelativeLayout.LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
params.addRule(RelativeLayout.BELOW, textView3.id)
params.addRule(RelativeLayout.ALIGN_PARENT_START, RelativeLayout.TRUE)
relativeLayout.addView(textView, params)

Menu Available across the whole app

Im trying to get my menu accessible across my app with out having to add the XML code to all my activities as well as the code in all the classes.
I already have a "BaseController" class that handle some aspects of the menu like the TabHost and text etc but I am unable to get the menu extrapolated so it can be used across the app without having to retype all my code over and over again?
HomeActivity.class
public class HomeActivity extends BaseController {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_home);
Log.i(TAG, "onCreate has been called");
menu();
mDrawerLayout =(CustomDrawerLayout)findViewById(R.id.home_activity);
left = (RelativeLayout) findViewById(R.id.left_menu);
menu_button = (ImageView) findViewById(R.id.menuImageButton)
}
private void openMenu() {
if (hasLoggedInBefore() == false) {
goToLogin();
} else {
mDrawerLayout.openDrawer(left);
}
}
activity_home.xml
<com.myapp.app.ui.CustomDrawerLayout
android:id="#+id/home_activity"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/bg"
tools:context=".MainActivity">
<include
layout="#layout/home_screen_items"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout
android:id="#+id/left_menu"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="#color/bob_orange6">
<TabHost
android:id="#+id/menuTabs"
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"
>
</TabWidget>
<FrameLayout
android:id="#android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/menu_tab1_tab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tab1 Tab Text"/>
</LinearLayout>
<LinearLayout
android:id="#+id/menu_tab2_tab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tab2 Tab Text"/>
</LinearLayout>
<LinearLayout
android:id="#+id/menu_tab3_tab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/white"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Tab3 Tab Text"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
</RelativeLayout>
as you can see above my menu is in the HomeActivity XML and if i try add it using the tag, the menu overlays the content and does not collapse.
The only way it works is if i do it the way i have above.
my BaseController.java
public class BaseController extends Activity {
CustomDrawerLayout mDrawerLayout;
RelativeLayout left;
public void menu(){
final TabHost menuTab = (TabHost)findViewById(R.id.menuTabs);
menuTab.setup();
TabHost.TabSpec tab1_tab_menu = menuTab.newTabSpec("Tab1");
tab1_tab_menu.setContent(R.id.menu_tab1_tab);
tab1_tab_menu.setIndicator("Tab1");
menuTab.addTab(tab1_tab_menu);
TabHost.TabSpec tab2_tab_menu = menuTab.newTabSpec("Tab2");
tab2_tab_menu.setContent(R.id.menu_tab2_tab);
tab2_tab_menu.setIndicator("Tab2");
menuTab.addTab(tab2_tab_menu);
TabHost.TabSpec tab3_tab_menu = menuTab.newTabSpec("Tab3");
tab3_tab_menu.setContent(R.id.menu_tab3_tab);
tab3_tab_menu.setIndicator("Tab3");
menuTab.addTab(tab3_tab_menu);
}
}
incase its needed i have include the CustomDrawerLayout code
CustomDrawerLayout.java
public class CustomDrawerLayout extends DrawerLayout{
public CustomDrawerLayout(Context context) {
super(context);
}
public CustomDrawerLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomDrawerLayout(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
#Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
widthMeasureSpec = MeasureSpec.makeMeasureSpec(
MeasureSpec.getSize(widthMeasureSpec), MeasureSpec.EXACTLY);
heightMeasureSpec = MeasureSpec.makeMeasureSpec(
MeasureSpec.getSize(heightMeasureSpec), MeasureSpec.EXACTLY);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}
The idea is to have it in the baseController class and pretty much call a method in the onCreate in a specific activity that i want the menu in as well as say in the xml for that Activity and the menu is basically there with the same content etc?
Been battling with this for a couple days now. Help will be greatly appreciated.
Thanks
Implemention for UrMenu should be done in BaseControllerActivity, and all other activities in our application must inhert this BaseControllerActivity. Then you can use that menu, and you can override if want to customize onClick of menu's.

Categories