Tag Archives: layout

Android: remove left margin from actionbar's custom layout

Questions: I am using a custom actionbar view, and as you can see in the screenshot below, there is a blank gray space in the actionbar. I want to remove it. What have I done: res/values-v11/styles.xml <style name=”AppBaseTheme” parent=”@style/Theme.AppCompat.Light”> <item name=”android:actionBarStyle”>@style/ActionBarStyle</item> <item name=”actionBarStyle”>@style/ActionBarStyle</item> </style> res/values/my_custom_actionbar.xml <resources xmlns:android=”http://schemas.android.com/apk/res/android”> <style name=”ActionBarStyle” parent=”@style/Widget.AppCompat.Light.ActionBar.Solid”> <item name=”android:height”>60dp</item> </style> </resources> Manifest… Read More »

CursorLoader In TabLayout with Multiple Fragments

Questions: Here’s the overall issue that I’m having. First, My app starts. It immediately stores data from two different .txt files(cocktails and food) into two different tables. I have a TabLayout with 2 fragments. Each fragment displays a RecyclerView with the appropriate data, 1 for cocktails and one for food. There is only one RecyclerView… Read More »

Unable to get the Data loaded on screen Error – E/RecyclerView: No adapter attached; skipping layout

Questions: The same code was working previously. Don’t now why its not working now. Using Android Compile and target SDK as 27. I have uploaded all required 7 files of the project at https://www.dropbox.com/sh/bg0bsadqpb9e034/AADlEdpXlP6nRLr6U5J1YI3sa?dl=0 implementation ‘com.android.support:recyclerview-v7:27.1.1’ implementation ‘com.android.volley:volley:1.1.1’ implementation ‘com.google.code.gson:gson:2.8.5’ implementation ‘com.android.support:cardview-v7:27.1.1’ implementation ‘com.github.bumptech.glide:glide:4.7.1’ And this is what I wrote. package com.example.sampleusers; import android.app.Activity; import… Read More »

Recyclerview item use LinearLayout as root, but LinearLayout match_parent not working

Questions: This is my itemview layout. <?xml version=”1.0″ encoding=”utf-8″?> <LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_parent” android:gravity=”center” android:orientation=”vertical” android:padding=”10dp”> <TextView android:id=”@+id/tv_ad” android:layout_width=”match_parent” android:layout_height=”wrap_content” android:ellipsize=”end” android:maxLines=”1″ android:textColor=”@android:color/white” /> <ImageView android:id=”@+id/img_ad” android:layout_width=”match_parent” android:layout_height=”match_parent” android:layout_below=”@id/tv_ad” android:background=”@color/colorPrimary” android:scaleType=”fitXY” android:src=”@mipmap/ic_launcher” /> </LinearLayout> This is my RecyclerView onCreateViewHolder() method. if (mLayoutInflater == null) { mLayoutInflater = LayoutInflater.from(parent.getContext()); } View root = mLayoutInflater.inflate(layoutResId, parent, false);… Read More »

Item of RecyclerView inside a ConstraintLayout does not occupy the full width of its parent

Questions: I’m having a problem using a RecyclerView within a ConstraintLayout, and wanted to confirm that I’m not doing anything wrong before declaring it as a bug. Basically I’ve defined a RecyclerView inside a ConstraintLayout: <android.support.constraint.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”> <android.support.v7.widget.RecyclerView android:layout_width=”match_parent” android:layout_height=”match_parent” app:layout_constraintTop_toTopOf=”parent” app:layout_constraintBottom_toBottomOf=”parent” app:layout_constraintLeft_toLeftOf=”parent” app:layout_constraintRight_toRightOf=”parent” android:id=”@+id/list”/> </android.support.constraint.ConstraintLayout> And I’ve defined its item which… Read More »