Why is my merge layout showing up twice inside LinearLayout? - android

I have a merge layout inside a parent LinearLayout. For some reason, the merge layout is showing up twice, one on top of the other, in the fragment when I run my app. Layout Inspector shows all the elements from the merge layout repeated below the first set, and all directly under the LinearLayout. Even weirder is that the repeated elements have the same id's.
Parent layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<include layout="#layout/child_layout" />
</LinearLayout>
Child layout:
<merge
xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="title" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="stuff" />
<Button
android:id="#+id/positiveButton"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button
android:id="#+id/negativeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</merge>
Fragment code:
private var _binding: ParentBinding? = null
private val binding get() = _binding!!
private var _contentBinding: ChildBinding? = null
private val contentBinding get() = _contentBinding!!
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
_binding = ParentBinding.inflate(layoutInflater)
_contentBinding = ChildBinding.inflate(layoutInflater, binding.root)
return binding.root
}

What's Happening?
You are inflating the parent layout 2 times in onCreateView.
Solution
Replace this: _contentBinding = ChildBinding.inflate(layoutInflater, binding.root)
With this: _contentBinding = ChildBinding.bind(binding.root)

Related

Bottom Sheet Dialog only showing one item of recyclerview

I realise this question has been asked previously but the answers provided haven't helped me out. I cannot see what is going wrong here.
I have an activity, in which I display a bottom sheet, the bottom sheet has a title and a recyclerview. The recycler view is only displaying one item, regardless of how many are passed to the adapter. It is possible to scroll through the items but only one at any time is visible.
Here is my activity 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"
tools:context=".features.order.automatedcheckout.view.AutomatedCheckoutQRCodeActivity"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/scanBarcodeInstruction"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="50dp"
android:text="Scan the barcode to get started"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Guideline
android:id="#+id/loadingGuideline"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ProgressBar
android:id="#+id/progressIndicator"
app:layout_constraintBottom_toTopOf="#+id/loadingGuideline"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/scanBarcodeInstruction"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatImageView
android:id="#+id/qrcodeImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="#+id/scanBarcodeInstruction"/>
<TextView
android:id="#+id/tenderName"
app:layout_constraintTop_toBottomOf="#+id/qrcodeImageView"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="#+id/changeTenderButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10dp"
android:visibility="gone"
android:layout_marginBottom="20dp"
android:layout_marginRight="20dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:text = "Change Tender"/>
</androidx.constraintlayout.widget.ConstraintLayout>
and here is my bottom sheet fragment xml:
<?xml version="1.0" encoding="utf-8"?>
<androidx.appcompat.widget.LinearLayoutCompat
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/bottomSheetLayout"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tenderTitle"
android:layout_marginTop="20dp"
android:layout_marginStart="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="SELECT"/>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/tenderList"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</androidx.appcompat.widget.LinearLayoutCompat>
my bottom sheet fragment:
class TenderBottomSheetFragment : BottomSheetDialogFragment() {
private var _binding: FragmentTenderBottomSheetBinding? = null
private val binding get() = _binding!!
private lateinit var onTenderClicks:(tenderDetails: Pair<Int?, String?>) -> Unit
lateinit var adapter: TenderAdapter
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_binding = FragmentTenderBottomSheetBinding.inflate(inflater, container, false)
adapter = TenderAdapter (
arguments?.parcelableArrayList(ARG_TENDERS)!!,
onTenderClicks
)
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
val layoutManager = LinearLayoutManager(requireContext())
binding.tenderList.layoutManager = layoutManager
binding.tenderList.addItemDecoration(DividerItemDecoration(requireContext(), layoutManager.orientation))
binding.tenderList.adapter = adapter
}
companion object {
fun newInstance(
campusTenders: List<TenderKt>,
onTenderClick: (tenderDetails: Pair<Int?, String?>) -> Unit
): TenderBottomSheetFragment {
val tenderDialogFragment = TenderBottomSheetFragment()
tenderDialogFragment.onTenderClicks = onTenderClick
tenderDialogFragment.apply {
arguments = Bundle().apply {
putParcelableArrayList(ARG_TENDERS, ArrayList(tenders))
}
}
return tenderDialogFragment
}
}
override fun onDestroyView() {
super.onDestroyView()
_binding = null
}
}
I'm sure this is something really simple but unfortunately right now, I'm not seeing it. If anyone could help I would really appreciate it.
UPDATE
Here is the recycler item layout:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
xmlns:app="http://schemas.android.com/apk/res-auto">
<TextView
android:id="#+id/campus_tender_name"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
tools:text ="Flex Account"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>
I have now updated that to:
<TextView
android:id="#+id/campus_tender_name"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:padding="10dp"
tools:text = "Flex Account"
android:textSize="16sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
and that works fine. So it was the constraint layout in the recycler view item

One TextView per line in LinearLayout

I am currently starting an Android app and want to build a list where each item occupies one single row. Right now I only have a TextView but will have more elements later.
I am having problems in placing one element per row since the TextViews just get placed one after the other, like this:
Android View
The layout for this is as follows:
<?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="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/twitterNumber"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="#dimen/text_margin"
android:textAppearance="?attr/textAppearanceListItem" />
</LinearLayout>
The code for the RecyclerView is:
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView 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/list"
android:name="codehero.twitteralarmclock.ui.main.tweet.TweetsFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
app:layoutManager="LinearLayoutManager"
tools:context=".ui.main.tweet.TweetsFragment"
tools:listitem="#layout/fragment_tweets" />
I've tried changing the orientation of the LinearLayout, adding the maxLines and singleLine attributes to the TextView but nothing changed.
Thanks for you help in advance!
Change the linear layout to a constraint layout like so and re run the code and check
<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="wrap_content">
<TextView
android:id="#+id/twitterNumber"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="#dimen/text_margin"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:textAppearance="?attr/textAppearanceListItem" />
</androidx.constraintlayout.widget.ConstraintLayout>
If this still doesn't solve your issue try to get rid of the text appearance attribute and layout margin attribute and recompile.
If it works then you know it's a problem of the attributes
If it still does not solve you might have to paste your adapter code
So it turns the Android Studio default FragmentList code will create a GridLayout if the list count is bigger than 1:
class TweetsFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
val view = inflater.inflate(R.layout.fragment_tweets_list, container, false)
// Set the adapter
if (view is RecyclerView) {
with(view) {
layoutManager = when {
columnCount <= 1 -> LinearLayoutManager(context)
else -> GridLayoutManager(context, columnCount)
}
adapter = TweetsViewAdapter(TwitterPlaceholderContent.ITEMS)
}
}
return view
}
}
The solution is to always create a LinearLayout inside the onCreateView method:
if (view is RecyclerView) {
with(view) {
layoutManager = LinearLayoutManager(context)
adapter = TweetsViewAdapter(TwitterPlaceholderContent.ITEMS)
}
}

NavigationComponent recyclerview return shared element transition

I use Navigation Component in project. Trying to set up shared element transitions from recycler. And enter transition in the second fragment works fine, but when I return to the first fragment - there is no return transition.
I tried to explicitly set enter and return transitions in the first fragment like I did in the second like this
val transition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
sharedElementEnterTransition = transition
sharedElementReturnTransition = transition
but it didn't help.
Also tried to remove enter and exit fragment animations. For the second fragment enter transition works with animations, but who knows.
also tried to use the solution from this question, but in my case it didn't work.
https://stackoverflow.com/a/52922835/10951565
mainFragment
stickyAdapter.onItemClick = { event, imageView, textView ->
val args = bundleOf(EventDetailFragment.EVENT to event)
val extras = FragmentNavigatorExtras(
imageView to imageView.transitionName,
textView to textView.transitionName
)
findNavController().navigate(R.id.action_global_eventDetailFragment, args, null, extras)
}
in adapter onClick I set unique transition names for the views:
mainFragmentAdapter
eventImageView.setOnClickListener {
titleTextView.transitionName = "${event.title}$TRANSITION_TITLE"
eventImageView.transitionName = "${event.title}$TRANSITION_IMAGE"
onItemClick?.invoke(event, eventImageView, titleTextView)
}
in detailsFragment I get transition names from arguments (copypasted them to be sure there is no mistakes and for enter transition it worked)
I call postponeEnterTransition() in OnCreate method to wait until i can set transition names, sharedElementEnterTransition and sharedElementReturnTransition in onViewCreated and then call startPostponedEnterTransition()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
postponeEnterTransition()
}
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? = inflater.inflate(R.layout.fragment_event_detail, container, false).apply {
val event = arguments?.getSerializable(EVENT) as Event?
toolbarImageView.transitionName = "${event?.title}$TRANSITION_IMAGE"
titleTextView.transitionName = "${event?.title}$TRANSITION_TITLE"
val transition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
sharedElementEnterTransition = transition
sharedElementReturnTransition = transition
startPostponedEnterTransition()
toolbar.setupWithNavController(findNavController())
event?.let {
Picasso.get()
.load("${EventGroupAdapter.BASE_SMALL_IMAGE_URL}${event.smallimage}")
.into(toolbarImageView)
}
}
}
main_fragment.xml
<?xml version="1.0" encoding="utf-8"?>
<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:id="#+id/coordinatorLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:context=".view.activity.MainActivity">
<com.google.android.material.appbar.AppBarLayout
android:id="#+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="256dp"
android:background="?android:colorBackground"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<androidx.viewpager.widget.ViewPager
android:id="#+id/viewPager"
android:layout_width="match_parent"
android:layout_height="200dp"
android:fitsSystemWindows="true" />
<com.rd.PageIndicatorView
android:id="#+id/pageIndicatorView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#id/viewPager"
android:layout_centerHorizontal="true"
android:layout_marginBottom="7dp"
app:piv_dynamicCount="true"
app:piv_interactiveAnimation="true"
app:piv_radius="3.5dp"
app:piv_selectedColor="#color/colorIndicatorSelected"
app:piv_unselectedColor="#color/colorIndicatorUnselected"
app:piv_viewPager="#id/viewPager" />
<include
android:id="#+id/horizontalScrollView"
layout="#layout/fragment_main_horizontal_scroll_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/viewPager" />
</RelativeLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<RelativeLayout
android:id="#+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<LinearLayout
android:id="#+id/emptyMessage"
android:layout_marginTop="40dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layoutAnimation="#anim/layout_animation_from_bottom"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="#drawable/ic_empty_events"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="#string/empty_events_message"
android:textSize="18sp" />
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="48dp"
android:nestedScrollingEnabled="true"
tools:listitem="#layout/fragment_main_event_item" />
</RelativeLayout>
<ProgressBar
android:id="#+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/programTextView"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="visible" />
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottomNavigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:colorBackground"
app:menu="#menu/bottom_navigation" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Please share your recipe of the return shared element transition with Navigation Component
I ran into this the other day where going from the MainFragment item to a DetailFragment animated fine, but the sharedElementReturnTransition wasn't working when pressing back.
The fix for me was to postpone the transition on the MainFragment. At first, I was trying to do so in onCreate, but onCreate isn't always called when going back, so the fix was to postpone it in onViewCreated (I would guess onCreateView might work too) and then start the transition once the RecyclerView is ready.
DetailFragment:
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val transition = TransitionInflater.from(context).inflateTransition(android.R.transition.move)
sharedElementEnterTransition = transition
sharedElementReturnTransition = transition
}
MainFragment:
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
postponeEnterTransition()
recycler_view.post { startPostponedEnterTransition() }
}

Android Add fragment within a fragment

I'm trying to add a fragment within a subclass of DialogFragment. I have a FrameLayout with an id pref_container that I want to replace with a fragment called settingsFragment.
The problem is that fragmentTransaction can't find R.id.pref_container, I don't know if this is because pref_container is only inflated in onCreateView rather than being part of the activity?
I am very new to Android programming, so thank you for your time.
class QuestionnaireDialog : DialogFragment() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.setStyle(DialogFragment.STYLE_NORMAL, R.style.AppTheme)
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater.inflate(R.layout.questionnaire_layout,container,true)
val settingsFragment = ExercisesOnlySettingsFragment()
val ft = fragmentManager?.beginTransaction()
/// **** Here fragmentTransaction can't find R.id.pref_container because it's inflated later and not loaded as part of the activity? ****
ft?.add(R.id.pref_container, settingsFragment)
ft?.commit()
return view
}
}
The runtime error I get is
No view found for id 0x7f09009c (com.lescadeaux.kegel:id/pref_container) for fragment ExercisesOnlySettingsFragment{4ba4b89 #1 id=0x7f09009c}
Here is relavent part of my XML for questionnaire_layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.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"
android:id="#+id/questionnaireLayout"
android:background="#android:color/background_light">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/scrollView"
app:layout_constraintTop_toBottomOf="#+id/textView5"
android:layout_marginBottom="8dp"
app:layout_constraintBottom_toTopOf="#+id/button"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="8dp"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginStart="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<!-- RELAVENT PART -->
<FrameLayout
android:layout_width="300dp"
android:layout_height="match_parent"
android:id="#+id/pref_container">
</FrameLayout>
<!-- RELAVENT PART -->
</LinearLayout>
</HorizontalScrollView>
</android.support.constraint.ConstraintLayout>
Please try to use getChildFragmentManager() (or its kotlin equivalent) instead of getFragmentManager() you are using - it will work.

FragmentTabHost with HorizontalScrollView

I'm trying to add HorizontalScrollView to FragmentTabHost. I was following 'Lore Giver' answer from FragmentTabHost with horizontal scroll
but its not working for me.
After implementing xml like this :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<android.support.v4.app.FragmentTabHost
android:id="#+id/tabHost"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true"
android:scrollbars="none">
<TabWidget
android:id="#+id/tabs"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"/>
</HorizontalScrollView>
<FrameLayout
android:id="#+id/tabHostContent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="48dp" />
</LinearLayout>
</android.support.v4.app.FragmentTabHost>
And setting it up like this :
override fun onCreateView(inflater: LayoutInflater?, container: ViewGroup?, savedInstanceState: Bundle?): View? {
val view = inflater!!.inflate(R.layout.home_tabs, container, false)
viewContext = view.context
tabHost = view.findViewById(R.id.tabHost)
tabHost.setup(view.context, fragmentManager, R.id.tabHostContent)
tabHost.addTab(tabHost.newTabSpec("home").setIndicator(context!!.getString(R.string.TAB_EMERGENCY)), EmergencyFragment::class.java, null)
tabHost.addTab(tabHost.newTabSpec("friends").setIndicator(context.getString(R.string.TAB_PRIVATE)), PrivateFragment::class.java, null)
tabHost.addTab(tabHost.newTabSpec("organizations").setIndicator(context!!.getString(R.string.ORGANIZATIONS)), OrganizationsFragment::class.java, null)
tabHost.tabWidget.dividerDrawable = null
tabHost.tabWidget.isStripEnabled = false
changeStyleOfSelectedTab()
tabHost.setOnTabChangedListener {
changeStyleOfSelectedTab()
(activity as MainActivity).tabChangedByClick(currentTab)
}
return view
}
my tabs were not scrolling horrizontaly. The last Title ("Organizations") has just wrapped itself (it was not fitting on screen).
After adding
tabHost.tabWidget.getChildAt(i).findViewById<TextView>(android.R.id.title).setSingleLine(true)
for each of the tabs, organization TITLE started scrolling inside its tab. What am I doing wrong ?
Bar after adding setSingleLine

Categories

Resources