Cart badge with bottom navigation view android - java

I'm building a shop android app which I need to set these items in bottom navigation view (Home, cart, favorites, more)
and I need to set badge on cart to view how many items in cart
I build bottom nav bar successfully but I can't add cart badge on icon.
this is my code in activity which I set menu for nav view.
MainActivity.java
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_products);
Objects.requireNonNull(getSupportActionBar()).hide();
context = this;
tools = Tools.getInstance(context);
prefs = Prefs.getInstance(context);
tools.DisplayLang(prefs.GetLang(),this);
nav = findViewById(R.id.bottom_nav_view);
nav.inflateMenu(R.menu.menu);
nav.setSelectedItemId(R.id.home);
getSupportFragmentManager().beginTransaction().replace(R.id.frag_container,new Home())
.commit();
nav.setOnItemSelectedListener(btm_nav);
}
NavigationBarView.OnItemSelectedListener btm_nav =
new NavigationBarView.OnItemSelectedListener() {
#Override
public boolean onNavigationItemSelected(#NonNull MenuItem item) {
Fragment fragment;
switch (item.getItemId()) {
case R.id.home:
fragment = new Home();
getSupportFragmentManager().beginTransaction().replace(R.id.frag_container,fragment).commit();
break;
case R.id.fav:
fragment = new Favourite();
getSupportFragmentManager().beginTransaction().replace(R.id.frag_container,fragment).commit();
break;
case R.id.cart:
fragment = new Cart();
getSupportFragmentManager().beginTransaction().replace(R.id.frag_container,fragment).commit();
break;
case R.id.more:
PopupMenu menu = new PopupMenu(Products.this,
findViewById(R.id.more));
menu.getMenuInflater().inflate(R.menu.pop_up,menu.getMenu());
tools.setForceShowIcon(menu);
menu.show();
break;
}
return true;
}
};
#menu/menu
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item android:id="#+id/home"
android:title="#string/home"
android:icon="#drawable/home"/>
<item android:id="#+id/cart"
android:title="#string/basket"
android:icon="#drawable/cart"
app:actionLayout="#layout/cart_layout"/>
<item android:id="#+id/fav"
android:title="#string/fav"
android:icon="#drawable/fav"/>
<item android:id="#+id/more"
android:title="#string/more"
android:icon="#drawable/more"/>
</menu>
#layout/cart_layout
<?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"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/img"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:src="#drawable/cart"
app:layout_constraintEnd_toStartOf="#+id/txt_count"
app:layout_constraintHorizontal_bias="0.458"
app:layout_constraintStart_toStartOf="#+id/txt_count"
app:layout_constraintTop_toTopOf="#+id/txt_count" />
<TextView
android:id="#+id/txt_count"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="668dp"
android:background="#drawable/cart_badge"
android:gravity="center"
android:padding="3dp"
android:text="0"
android:textColor="#color/white"
android:textSize="10dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.598"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
I don't have any errors but my problem is that badge doesn't appear on cart icon. How can I do that ?

If you are using the Material Components library, then there is no need to create an extra layout for your badge, unless you want a custom badge. For adding badge to a menu item, first initialize a BadgeDrawable with your menu item's id. For example:
BadgeDrawable badge = nav.getOrCreateBadge(R.id.cart);
Here, nav is your bottom navigation view and R.id.cart is your menu item's id. After initialization, set the badge to be visible by badge.setVisible(true); and finally set the number on the badge by badge.setNumber(1);. You can even set the badge's background color by badge.setBackgroundColor(getResources().getColor(R.color.red)); and badge's text color by badge.setTextColor(getResources().getColor(R.color.white));. And finally when you want to remove the number just call badge.clearNumber();.

Related

Using bottom nav bar

I am trying to make a bottom navigation bar to navigation bar between activities but I find using fragments very confusing so I tried using but its not working tried to look for something that I can use but I did not find anything online so as people who have experience can I use bottom navigation bar without fragments.
My code:
private BottomNavigationView.OnNavigationItemSelectedListener
mOnNavigationItemSelectedListener
= new BottomNavigationView.OnNavigationItemSelectedListener() {
#Override
public boolean onNavigationItemSelected(#NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.navigation_dashboard:
Intent intent1 = new Intent(RedirectedsearchActivity.this,
SearchActivity.class);
startActivity(intent1);
return true;
It didn’t work.
You can try the navigation component.
With it, it is much easier to work with fragments.
There are a couple of links to documentation and articles.
Documentation https://developer.android.com/guide/navigation
And tutorial https://www.androidauthority.com/android-navigation-architecture-component-908660/
Try this code and make activity_main layout.. without fragment it not working that time you need each and every activity define bottom navigation.
<?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"
android:layout_width="match_parent"
android:fitsSystemWindows="true"
android:layout_height="match_parent">
<include
android:id="#+id/amToolbar"
layout="#layout/app_toolbar"
/>
<FrameLayout
android:id="#+id/activity_main_container"
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
app:layout_constraintTop_toBottomOf="#+id/amToolbar"
app:layout_constraintBottom_toTopOf="#id/bottom_navigation"
/>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemIconTint="#drawable/bottom_navigation_colors"
app:itemTextColor="#drawable/bottom_navigation_colors"
app:labelVisibilityMode="labeled"
app:layout_constraintBottom_toBottomOf="parent"
app:menu="#menu/bottom_menu" />
</androidx.constraintlayout.widget.ConstraintLayout>
after that mainActivity call click event..
// Set action to perform when any menu-item is selected.
bottom_navigation.setOnNavigationItemSelectedListener { item ->
item.isChecked = true
selectFragment(item)
false
}
private fun selectFragment(item: MenuItem?) {
item?.isChecked = true
when (item?.itemId) {
R.id.action_uploadFile -> {
// here define fragment change
}
}
}

onNavigationItemSelected not being called for Bottom Navigation Bar

I'm trying to implement a bottom nav bar that changes fragments when the nav items are clicked. However, when I click on the nav bar items, the fragments don't change. Using log.d, I noticed onNavigationItemSelected is not being called. How do I fix this?
To note, the startFeedFragment, startScheduleFragment, & startSettingsFragmentare implemented the same way and they work for the buttons in the toolbar. I also referenced this tutorial and this question for help.
MainActivity.java
public class MainActivity extends AppCompatActivity implements BottomNavigationView.OnNavigationItemSelectedListener {
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
setUpRecycler();
startFeedFragment();
BottomNavigationView bottomNavBar = (BottomNavigationView) findViewById(R.id.navigation);
bottomNavBar.bringToFront();
bottomNavBar.setOnNavigationItemSelectedListener(this);
}
#Override
public boolean onNavigationItemSelected(#NonNull MenuItem item) {
Log.d("NAV BAR", "onNavigationItemSelected hit");
switch (item.getItemId()) {
case R.id.feedMenu:
startFeedFragment();
Log.d("NAV BAR", "feed");
break;
case R.id.myScheduleMenu:
startScheduleFragment();
Log.d("NAV BAR", "schedule");
break;
case R.id.settingsMenu:
startSettingsFragment();
Log.d("NAV BAR", "settings lol");
break;
default:
Log.d("NAV BAR", "false");
return false;
}
return true;
}
/**
* Switches out the fragment for {#link FeedFragment} and sets an appropriate title. startScheduleFragmens & startSettingsFragment are implemented the same way
*/
private void startFeedFragment()
{
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fragmentContainer, new FeedFragment());
transaction.commit();
getSupportActionBar().setTitle(R.string.title_fragment_feed);
}
}
Snippet from xml file
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<FrameLayout
android:id="#+id/fragmentContainer"
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintBottom_toTopOf="#+id/navigation"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<android.support.design.widget.BottomNavigationView
android:id="#+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:itemBackground="#android:color/white"
app:itemIconTint="#color/colorPrimaryDark"
app:itemTextColor="#color/colorPrimaryDark"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:menu="#menu/bottom_nav"
android:elevation="8dp"/>
</android.support.constraint.ConstraintLayout>
</android.support.design.widget.CoordinatorLayout>
Solved! It was because I had set the buttons in the menu to android:enabled="false". That meant they couldn't be pressed, which is why onNavigationItemSelected wasn't being called. I set all buttons to android:enabled="true" to fix this.
Correct code for bottom_nav.xml
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#+id/bottom_nav_my_schedule"
android:title="#string/menu_my_schedule"
android:icon="#drawable/ic_event_available_white_24dp"
android:enabled="true"/> <!--make sure enabled is set to true!-->
<item android:id="#+id/bottom_nav_feed"
android:title="#string/menu_feed"
android:icon="#drawable/ic_view_list_white_24dp"
android:enabled="true" /> <!--make sure enabled is set to true!-->
<item android:id="#+id/bottom_nav_settings"
android:title="#string/menu_settings"
android:icon="#drawable/ic_settings_white_24dp"
android:enabled="true"/> <!--make sure enabled is set to true!-->
</menu>
As for me the problem was when my activity main layout was LinearLayout, so I've solved it by changing it to RelativeLayout, I have absolutely no thoughts why it's working, because RelativeLayout layouts reply only for elements location, not its view or something else, but it's working.
<RelativeLayout
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="vertical"
>
<android.support.v4.view.ViewPager
android:id="#+id/view_pager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<android.support.design.widget.BottomNavigationView
android:id="#+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:itemBackground="#drawable/selector"
android:background="#color/white"
app:menu="#menu/menu_bottom"
app:itemIconTint="#drawable/menu_trainings"
app:labelVisibilityMode="unlabeled"
/>
</RelativeLayout>

How to customize tab bar with icons?

Can someone explain to me what I should add exactly to this code from this website:
III. To change tab icon use TabLayout.Tab#setIcon method. You can get TabLayout.Tab object via TabLayout#getTabAt method, which accept tab index as parameter.
...
//after initialization TabLayout and ViewPager
TabLayout.Tab tabCall = tabLayout.getTabAt(ITEM_CALL);
tabCall.setIcon(R.drawable.selector_call);
//repeat this code for all your tabs
...
Because I get tabLayout and ITEM_CALL in red!
You need to first create the selector xml files, and place them in your drawable folder, and those selector files need to reference valid drawables for the selected and non-selected states.
Then, just set the tab icons in onCreate() of the Activity.
Here is what your Activity should look like in order to show three tabs, with each tab showing only an icon:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ViewPager viewPager = (ViewPager) findViewById(R.id.viewPager);
viewPager.setAdapter(new TabPagerAdapter(getSupportFragmentManager()));
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
tabLayout.setupWithViewPager(viewPager);
TabLayout.Tab tabCall = tabLayout.getTabAt(0);
tabCall.setIcon(R.drawable.selector_call);
TabLayout.Tab tabHeart = tabLayout.getTabAt(1);
tabHeart.setIcon(R.drawable.selector_heart);
TabLayout.Tab tabContacts = tabLayout.getTabAt(2);
tabContacts.setIcon(R.drawable.selector_contacts);
}
class TabPagerAdapter extends FragmentPagerAdapter {
public TabPagerAdapter(FragmentManager fm) {
super(fm);
}
#Override
public int getCount() {
return 3;
}
#Override
public Fragment getItem(int position) {
switch (position) {
case 0:
return new CallFragment();
case 1:
return new HeartFragment();
case 2:
return new ContactsFragment();
}
return null;
}
}
}
Each tab needs its own selector xml file, here is an example of what the selector for the third tab should look like:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="#drawable/contacts_selected" />
<item
android:state_selected="false"
android:drawable="#drawable/contacts_unselected" />
</selector>
declare this as a constant in your MainActivity class
private static final Striing ITEM_CALL = 0;
do this declaration on your onCreate() :
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
then create selector_call.xml in the drawable folder with this code :
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_selected="true"
android:drawable="#drawable/ic_call_selected" />
<item
android:state_selected="false"
android:drawable="#drawable/ic_call_unselected" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<!-- coordinate layout add more than one widget in systematic way and
inhance others property-->
<androidx.coordinatorlayout.widget.CoordinatorLayout
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=".Tab_Bar">
<!--Add space for toolbar and tab bars-->
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<!-- "?attr/actionBarSize" means same size as
original Toolbar size
"scroll|enterAlways" here "scroll" means when
we scroll viewPager up it is scrolled up and "enterAlways" means when
we scroll up it reappears -->
<androidx.appcompat.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:layout_scrollFlags="scroll|enterAlways"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" />
<!--tabGravity="fill", if you want the tabs to be occupied the
fullwidth of the screen
If you want to keep your tabs horizontally centered, assign
tabGravity="center"
app:tabMode=> Defines the mode of the tab layout.
In our case the value should be “fixed” as we have limited number of
tabs but if you have many number of tabs where there is insufficient
space on the screen to fit all of them the you can change the
app:tabMode to "scrollable".-->
<com.google.android.material.tabs.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabMode="fixed"
app:tabIndicatorColor="#F4F7FA"
app:tabGravity="fill">
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="One"
android:icon="#drawable/one_img"/>
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Two"
android:icon="#drawable/two_img"/>
</com.google.android.material.tabs.TabLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="#string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

How to Set Icon to display on the far right in Java

getSupportActionBar().setLogo(R.drawable.addicon);
The code above seems to place my Icon in the Centre . I would like to place to the far right and make it clickable as well . At the moment it the image for the icon is in the project files as a drawable I have not included it in any xml files.
You can set android:layoutDirection="rtl" in your toolbar xml for place it to right and
set below code for clickable :
getSupportActionbar().setDisplayHomeAsUpEnabled(true);
and :
#Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
//Do stuff
return true;
default:
return super.onOptionsItemSelected(item);
}
}
There are 2 approaches for doing that.
Option Menus
Creating custom toolbar.
With Option Menus
create main.xml under res/menu.
<menu 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"
tools:context="com.ioa.MainActivity" >
<item
android:id="#+id/action_addition"
android:icon="#drawable/addicon"
android:orderInCategory="100"
android:title="Addition"
app:showAsAction="always"/>
</menu>
and inside your activity create menu like,
#Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
you can perform Action on particular menu item.
#Override
public boolean onOptionsItemSelected(MenuItem Item) {
if (Item.getItemId() == R.id.action_addition) {
// perform action
}
return super.onOptionsItemSelected(paramMenuItem);
}
With custom toolbar
Create your ToolBar like this,
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/ColorPrimary"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/add"
android:layout_width="46dp"
android:layout_height="46dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="4dp"
android:clickable="true"
android:src="#drawable/ic_launcher" />
</RelativeLayout>
</android.support.v7.widget.Toolbar>
and now you can perform click event of particular ImageView.
ImageView add = (ImageView) findViewById(R.id.add);
add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
// do work.
}
});
happy Coding.
You Need 3 Things:
A Custom Toolbar Layout
Include the toolbar in your activity
Set the Logo to the toolbar
Create new Resource Layout:
include_toolbar.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?attr/colorPrimaryDark"
android:id="#+id/include_toolbar"
app:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar" />
Change Your Activity File: MainActivity.java
public class BaseActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
Toolbar toolbar = (Toolbar)findViewById(R.id.include_toolbar);
setSupportActionBar(toolbar);
toolbar.setNavigationIcon(R.mipmap_ic_launcher);
}
}
And here's the styles.xml:
<!-- language: xml-->
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#3F51B5</color>
</resources>

With a DrawerLayout, how can I close the app on pressing Back no matter which screen is active?

I'm using a DrawerLayout for the navigation of my app:
Taking this menu for the example:
I'd like the Home button to launch the HomeActivity and so on. But clearing the activity stack, that is: If I press People, then Photos, then Locations and then the back button, the app should close. I'm trying intent flags when launching the activities but I always get the same behaviour: People->Photos->Location->Back goes to Photos instead closing the app
How can I achieve that?
As per you said that "If I press People, then Photos, then Locations and then the back button, the app should close".
For achieve that you should user Fragment for Home,People,Location and Photos etc.
and when you press back button of Device you can clear Fragment back stack and finish activity.
I think this code may help you. When you press Back button of a device it will close the application.
In MainActivity.java,
public void SelectItem(int possition)
{
//Using Fragment here
Fragment fragment = null;
Bundle args = new Bundle();
switch (possition)
{
//Can use Fragment for Home,People,Location and Photos etc. and when you press back button of Device you can clear Fragment back stack and finish activity.
case 0:
fragment=new FragmentNewsFeed();
break;
case 1:
fragment = new FragmentMessages();
break;
default:
break;
}
fragment.setArguments(args);
FragmentManager frgManager = getFragmentManager();
frgManager.beginTransaction().replace(R.id.content_frame, fragment).commit();
listView_drawer.setItemChecked(possition, true);
setTitle(dataList.get(possition).getItemName());
drawerLayout.closeDrawer(listView_drawer);
}
In FragmentNewsFeed class,
public class FragmentNewsFeed extends Fragment
{
public FragmentNewsFeed()
{
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState)
{
View view = inflater.inflate(R.layout.fragment_news_feeds, container,false);
return view;
}
}
Whereas you can find content frame in a layout/activity_main.xml,
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="#+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="#+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#android:color/transparent"
android:dividerHeight="0dp"
android:background="#ffff"/>
</android.support.v4.widget.DrawerLayout>
In R.layout.fragment_news_feeds,
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linear_Parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#008B8B"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/linear_1"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_weight="0.30"
android:background="#2F4F4F"
android:orientation="vertical" >
<ListView
android:id="#+id/listView_OwnItems"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</LinearLayout>

Categories