I was trying to implement wearable listview. For each list items i tried to use cardframe(android.support.wearable.view.CardFrame). While scrolling, size of card frame expands automatically. What is solution for this?
This is my xml for WearableListView-:
<FrameLayout
android:id="#+id/frame_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"
app:layout_box="all">
<android.support.wearable.view.WearableListView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/lv_result"
android:layout_width="match_parent"
android:layout_height="450dp"
android:layout_gravity="center_vertical" />
</FrameLayout>
Layout for each items in listview-:
<android.support.wearable.view.CardScrollView
android:id="#+id/card_scroll_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_box="bottom" >
<android.support.wearable.view.CardFrame
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/linear_srp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/blue"
android:orientation="vertical" >
<TextView
android:id="#+id/text_post"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="JOB POST"
android:textColor="#color/black"
android:textSize="9sp" />
<TextView
android:id="#+id/text_companyName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="COMPANY NAME"
android:textColor="#color/black"
android:textSize="9sp" />
<TextView
android:id="#+id/text_exp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="EXPERIENCE"
android:textColor="#color/black"
android:textSize="9sp" />
<TextView
android:id="#+id/text_city"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="CITY"
android:textColor="#color/black"
android:textSize="9sp" />
</LinearLayout>
</android.support.wearable.view.CardFrame>
</android.support.wearable.view.CardScrollView>
Related
I want to take print of XML layout but I Have no idea to print the Xml Layout I am trying from many days but I does not found any help because my data is retrieve from sqlite databse in listview I have no mutch knowledge so requested you give som ideas [enter image description here]
[1]
[1]: https://i.stack.imgur.com/jn7hi.jpg
//XML Code is given below
<?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="wrap_content"
android:id="#+id/printbil"
android:orientation="vertical"
tools:ignore="MissingClass">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="5"
android:layout_marginTop="20dp"
android:id="#+id/ltt">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sr.No"
android:layout_marginStart="5dp"
android:layout_weight="0.5"
android:gravity="start"
android:textColor="#color/black"
android:layout_marginLeft="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Name"
android:gravity="start"
android:layout_weight="2"
android:textColor="#color/black"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.5"
android:gravity="start"
android:text="Quantity"
android:textColor="#color/black"
/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="2"
android:gravity="start"
android:text="Price"
android:textColor="#color/black"
/>
</LinearLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/ltt"
>
<!-- <ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/scrol">-->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/lvid">
<ListView
android:id="#+id/itemsalelist"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
<!-- </ScrollView>-->
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tp"
android:layout_marginTop="10dp"
android:layout_below="#id/lvid"
android:layout_alignParentEnd="true"
android:text="0.0"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:textColor="#color/black"
android:layout_alignParentRight="true" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tptv"
android:layout_marginTop="10dp"
android:layout_below="#id/lvid"
android:layout_toStartOf="#id/tp"
android:text="Total price"
android:textColor="#color/black"
android:layout_toLeftOf="#id/tp" />
<Button
android:id="#+id/btnPrint"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_below="#id/lvid"
android:layout_marginTop="30dp"
android:text="Print Bill" />
</RelativeLayout>
</RelativeLayout>
Check this out:
https://github.com/intsab/LayoutToImage
You have to convert your layout to a bitmap > Then print the output bitmap.
I,m designing one layout file which contain education information , earlier information was not fitting into screen so I have added Scroll view. I'm able to scroll down the screen but not completely. I tried putt scrollView top of all the relative layout, but it not scrolling completely, i tried enter link description here but not able to resolve my problem.
need help?
fragment_education.xml
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/slide_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/slide_title"
android:background="#color/Blue"
android:paddingLeft="#dimen/slide_title">
<RelativeLayout
android:id="#+id/be_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/be_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="SKIT,Banglore"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="#string/course_detail"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/th12_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/be_details"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/th12_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2012"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/th12_year"
android:text="SLIC,Rampur"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/th12_year"
android:text="#string/th12_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/school_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_detail"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/scl_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2010"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/scl_year"
android:text="SRHS,Tanda"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scl_school"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/scl_year"
android:text="#string/school_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
</ScrollView>
where am doing wrong?
Remove android:layout_marginBottom="#dimen/slide_title" and android:layout_marginTop="#dimen/slide_title"from first RelativeLayout after ScrollView and it will work
The only things to be done for the solution just add a nested scroll view within the scrollview here is the working code :
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="#dimen/slide_title"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/slide_title"
android:background="#color/Blue"
android:paddingLeft="#dimen/slide_title">
<RelativeLayout
android:id="#+id/be_details"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp">
<TextView
android:id="#+id/be_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2016"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="SKIT,Banglore"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/be_year"
android:text="#string/course_detail"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/th12_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/be_details"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/th12_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2012"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_college"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/th12_year"
android:text="SLIC,Rampur"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/th12_course"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_college"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/th12_year"
android:text="#string/th12_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/school_detail"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/th12_detail"
android:layout_marginTop="#dimen/slide_title">
<TextView
android:id="#+id/scl_year"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="2010"
android:textSize="#dimen/slide_title"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_school"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#+id/scl_year"
android:text="SRHS,Tanda"
android:textSize="20dp"
android:textStyle="bold" />
<TextView
android:id="#+id/scl_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/scl_school"
android:layout_marginLeft="#dimen/slide_title"
android:layout_toRightOf="#id/scl_year"
android:text="#string/school_details"
android:textColor="#color/lighter"
android:textSize="20sp" />
</RelativeLayout>
</RelativeLayout>
</android.support.v4.widget.NestedScrollView>
</ScrollView>
Please view the image below:
The first image is the layout I did and it show normally on my device and another test devices. The second image is the layout showed on my friend device, it is reversed. I do not know why, and it just happened on few devices.
This is my layout code on xml.
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:auto="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"
tools:context=".activities.ComposeSmsActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="#+id/toolbar"
layout="#layout/toolbar_action" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="#dimen/padding_5">
<com.hnib.smslater.views.FlowLayout
android:id="#+id/layout_name_recipient"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/margin_10"
android:fontFamily="sans-serif-light"
android:orientation="horizontal">
</com.hnib.smslater.views.FlowLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="#dimen/padding_10">
<com.hnib.smslater.views.ClearableAutoContactCompleteTextView
android:id="#+id/et_recipient"
android:layout_width="#dimen/width_et_contact"
android:layout_height="#dimen/height_et_default"
android:layout_centerVertical="true"
android:layout_marginTop="#dimen/margin_10"
android:background="#drawable/drawable_radius_gray_gray"
android:fontFamily="sans-serif-light"
android:hint="#string/to_"
android:imeOptions="actionDone"
android:padding="#dimen/padding_5"
android:textColorHint="#color/gray"
android:textSize="18sp"
android:textStyle="bold"
auto:displayPhotoIfAvailable="false"
auto:styleOfTypedLetters="bold"
auto:typeOfData="phone"
auto:typedLettersHaveDifferentStyle="true" />
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/margin_5"
android:layout_marginTop="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:fontFamily="sans-serif-light"
android:text="#string/message"
android:textColor="#color/gray"
android:textSize="18sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_message_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:fontFamily="sans-serif-light"
android:text="160/1" />
</RelativeLayout>
<com.hnib.smslater.views.ActionEditText
android:id="#+id/et_text_content"
android:layout_width="match_parent"
android:layout_height="#dimen/height_et_big"
android:layout_marginLeft="#dimen/margin_5"
android:background="#drawable/drawable_radius_gray_gray"
android:ems="10"
android:fontFamily="sans-serif-light"
android:gravity="top"
android:inputType="textMultiLine"
android:maxLines="10"
android:padding="#dimen/padding_5"
android:scrollbars="vertical" />
<RelativeLayout
android:id="#+id/layout_time"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:padding="#dimen/padding_10"
android:showDividers="middle">
<TextView
android:id="#+id/tv_title_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:background="#drawable/drawable_radius_acent_gray"
android:fontFamily="sans-serif-light"
android:padding="#dimen/padding_5"
android:text="#string/time"
android:textAllCaps="true" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_toRightOf="#+id/tv_title_time"
android:divider="?android:attr/dividerVertical"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/padding_10"
android:showDividers="middle">
<TextView
android:id="#+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/selector_textview"
android:fontFamily="sans-serif-light"
android:gravity="center_horizontal"
android:text="12/06/2016"
android:textColor="#color/gray"
android:textSize="27sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="#drawable/selector_textview"
android:fontFamily="sans-serif-light"
android:gravity="center_horizontal"
android:text="09:10"
android:textColor="#color/gray"
android:textSize="27sp"
android:textStyle="bold" />
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/padding_10">
<TextView
android:id="#+id/tv_title_repeat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="30dp"
android:background="#drawable/drawable_radius_acent_gray"
android:fontFamily="sans-serif-light"
android:padding="#dimen/padding_5"
android:text="#string/repeat"
android:textAllCaps="true" />
<Spinner
android:id="#+id/spinner_repeat"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Spinner>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_choose_sim"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/padding_10">
<TextView
android:id="#+id/title_choose_sim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginRight="30dp"
android:background="#drawable/drawable_radius_acent_gray"
android:fontFamily="sans-serif-light"
android:padding="#dimen/padding_5"
android:text="#string/choose_sim"
android:textAllCaps="true" />
<Spinner
android:id="#+id/spinner_choose_sim"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Spinner>
</LinearLayout>
<LinearLayout
android:id="#+id/layout_confirm"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center_vertical"
android:orientation="horizontal"
android:padding="#dimen/padding_10">
<TextView
android:id="#+id/tv_title_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginRight="15dp"
android:background="#drawable/drawable_radius_acent_gray"
android:fontFamily="sans-serif-light"
android:padding="#dimen/padding_5"
android:text="#string/ask_before_send"
android:textAllCaps="true" />
<CheckBox
android:id="#+id/checkbox_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/tv_title_confirm" />
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
Please have a help on this issue. Thanks.
The language on your friend's phone is probably different from yours, leading to the app giving a read from right to left, rather than your left to right. Does your friend have his phone's settings on language set to Hebrew or Arabic?
Edit: please take note of the answers below mine, those are the viable options for your friend's phone, besides for changing the language of course.
You should remove android:supportsRtl="true"
from the <application> element in your AndroidManifest.xml file.
You should ADD : android:supportRTL="false"
In the manifest
I want to set the text field above the black image and i want the width of text field should be equal to image.
I dont want to put hardcoded dimensions. Also both the blocks should qually cover the screen horizontally.
Here is my code `
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/RL_childLeft1"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<com.ism.eshita.incentivemanagmentsystem.Speedometer.Speedometer
android:id="#+id/Speedometer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#000000"
custom:currentSpeed="100"
custom:maxSpeed="300" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<TextView
android:id="#+id/tv_bg1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/PrimaryDark2"
android:gravity="center"
android:text="BG"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_performance1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/PrimaryDark2"
android:gravity="center"
android:paddingBottom="5dp"
android:text="Performance"
android:textColor="#color/white" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
>
<com.ism.eshita.incentivemanagmentsystem.Speedometer.Speedometer
android:id="#+id/Speedometer2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#000000"
custom:currentSpeed="100"
custom:maxSpeed="300" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="vertical">
<TextView
android:id="#+id/tv_bg2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#color/PrimaryDark2"
android:gravity="center"
android:text="BG"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold" />
<TextView
android:id="#+id/tv_performance2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#color/PrimaryDark2"
android:gravity="center"
android:paddingBottom="5dp"
android:text="Performance"
android:textColor="#color/white" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Does anyone know of any documentation on the android:scrollbarStyle? I'd like to see examples of each of the 4 values w/ screenshots if possible. I see the difference between outside & inside types, but what are the Inset & Outset parts all about? I dont seem to see a difference between insideOutset & insideInset for example, likewise, I don't see a difference between outsideOutset & outsideOutset.
thanks in advance!
Ben
Here's a little more detailed example. I set up background colors to make it more obvious what's going on here.
First, the colors:
black - margins
white - padding
gray - the contents of the scrollview
green - the scrollbar if it takes up its own space (I added this explicitly as a scrollbarTrackVertical for the two "inset" examples)
Let's define two sections:
"content area" - the stuff to be displayed in the scroll view
"padding" - the space around the content of the scroll view
Let's think about the two parts of the scrollBarStyle separately:
inside - the scrollbar appears inside the content area (the padding wraps around both the content and the scrollbar)
outside - the scrollbar appears outside the content area
overlay - the scrollbar overlays the right edge of the section it's in
inset - the scrollbar pushes the section it's in to the left, taking up its own space
The layout xml appears below
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000"
>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbarStyle="insideOverlay"
android:background="#fff"
android:fadeScrollbars="false"
android:layout_margin="8dp"
android:padding="16dp" >
<LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#aaa" >
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideOverlay"/>
</LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbarStyle="insideInset"
android:background="#fff"
android:scrollbarTrackVertical="#drawable/green_block"
android:fadeScrollbars="false"
android:layout_margin="8dp"
android:padding="16dp" >
<LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#aaa" >
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="insideInset" />
</LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:scrollbarStyle="outsideOverlay"
android:background="#fff"
android:fadeScrollbars="false"
android:layout_margin="8dp"
android:padding="16dp" >
<LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#aaa" >
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideOverlay" />
</LinearLayout>
</ScrollView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="#fff"
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:scrollbarTrackVertical="#drawable/green_block"
android:fadeScrollbars="false"
android:layout_margin="8dp"
android:padding="16dp" >
<LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="#aaa" >
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
<TextView android:textSize="32sp" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="outsideInset" />
</LinearLayout>
</ScrollView>
</LinearLayout>
To set the scrollbar style programmatically:
setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY)
setScrollBarStyle(View.SCROLLBARS_INSIDE_INSET)
setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY)
setScrollBarStyle(View.SCROLLBARS_OUTSIDE_INSET)
There are no values like outsideOutset and insideOutset. Possible four values are insideOverlay, insideInset, outsideOverlay, outsideInset
the documentation is there at following two links...
http://developer.android.com/reference/android/view/View.html#attr_android:scrollbarStyle
http://developer.android.com/reference/android/view/View.html#SCROLLBARS_INSIDE_INSET
I couldn't understand the documentation properly.
So taking reference from ApiDemos Scrollbar demo, I tried this. But i found that there is no difference in insideInset and outsideOverlay.
These two values are diff, either it should have both as Inset or Overlay
updated scrollbar3.xml is
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:id="#+id/view1"
android:layout_width="100dip"
android:layout_height="120dip"
android:padding="8dip"
android:scrollbarStyle="insideOverlay"
android:background="#android:color/white"
android:overScrollMode="never">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#android:color/darker_gray"
android:text="#string/scroll_text" />
</ScrollView>
<ScrollView
android:id="#+id/view2"
android:layout_width="100dip"
android:layout_height="120dip"
android:padding="8dip"
android:scrollbarStyle="insideInset"
android:background="#android:color/white"
android:overScrollMode="never">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#android:color/darker_gray"
android:text="#string/scroll_text" />
</ScrollView>
<ScrollView
android:id="#+id/view3"
android:layout_width="100dip"
android:layout_height="120dip"
android:padding="8dip"
android:scrollbarStyle="outsideOverlay"
android:background="#android:color/white"
android:overScrollMode="never">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#android:color/darker_gray"
android:text="#string/scroll_text" />
</ScrollView>
<ScrollView
android:id="#+id/view4"
android:layout_width="100dip"
android:layout_height="120dip"
android:padding="8dip"
android:scrollbarStyle="outsideInset"
android:background="#android:color/white"
android:overScrollMode="never">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#ffffff"
android:background="#android:color/darker_gray"
android:text="#string/scroll_text" />
</ScrollView></LinearLayout>
I hope someone will see this and clarify...
Above answers didn't quite work for me, so I came up with the following:
If this is what you want to achieve, here it goes:
ListView:
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="outsideOverlay"
android:scrollbarThumbVertical="#drawable/scrollbar" />
Scrollbar drawable:
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="#android:color/transparent"
android:width="20dp"/>
<item
android:drawable="#android:color/holo_red_dark"
android:right="18dp" />
</layer-list>
Thanks to this answer