Android: Floating Bar in Layout -


Does anyone know how to add a floating bar that will be at the top of the layout page, even if a user scrolls Be content through that layout?

Just add that time to the top of your layout and the rest of the content is a scrollview . For example:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" Android: Orientation = "Vertical" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" & gt; & Lt ;! - Header - & gt; & Lt; TextView Android: layout_width = "fill_parent" Android: layout_height = "wrap_content" android: text = "your header" /> & Lt ;! - Your remaining layout - & gt; & Lt; ScrollView Android: layout_width = "fill_parent" Android: layout_height = "fill_content" & gt; & Lt; TextView Android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: text = "foo" /> & Lt; TextView Android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: text = "bar" /> & Lt; TextView Android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: text = "hawk" /> & Lt; TextView Android: layout_width = "fill_parent" android: layout_height = "wrap_content" android: text = "etc" /> & Lt; / Scrollview & gt; & Lt; / LinearLayout & gt;  

In this way, the wrapped part of your view will be scrolled, while the header will remain on the same site.


Comments