This layout is a background image, title, and 2 columns. The first column is an image. The second column is a Name and Subtitle. Looking at the 2 columns, the left image is slightly above the text column. Adding "layout_alignParentTop="true" to the LinearLayout text column didn't help.
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="#+id/background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="#drawable/nature_backdrop"
android:scaleType="centerCrop"/>
<LinearLayout
android:id="#+id/content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/main_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="15dp"
android:textColor="#color/steel_grey"
android:textSize="20sp"
android:text="#string/intro_title"/>
<RelativeLayout
android:id="#+id/first_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="#+id/first_row_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:src="#drawable/flight"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toRightOf="#id/first_row_icon"
android:layout_alignParentTop="true">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#color/white"
android:text="#string/flight_info"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:text="#string/flight_info_desc"/>
</LinearLayout>
</RelativeLayout>
Try setting gravity on the linear layout and the contents if necessary. If you are targeting api level 17 and up you can set textAlignment="gravity".
I also blended your bg image into the linear layout. That may or may not work for you, but thought it might save you some code.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/content"
android:background="#drawable/nature_backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/main_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="15dp"
android:textColor="#color/steel_grey"
android:textSize="20sp"
android:text="#string/intro_title"/>
<RelativeLayout
android:id="#+id/first_row"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:layout_marginBottom="10dp">
<ImageView
android:id="#+id/first_row_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="6dp"
android:src="#drawable/flight"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_toRightOf="#id/first_row_icon"
android:gravity="top">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textColor="#color/white"
android:text="#string/flight_info"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#color/white"
android:text="#string/flight_info_desc"/>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
Related
I have a custom drawable as a background to the root of my framelayout with opacity(alpha) of 0.1. I have a LinearLayout inside which has some TextView. When I set my TextViews to the color of my FrameLayout's color it disappears( with no opacity ). How can I set opacity to my background(FrameLayout) without affecting my textviews(child of Framelayout). I have tried a lot of ways but it always hides the textviews inside.
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="#drawable/ic_img_bg"
android:alpha="0.1"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/linearlayout"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:text="Not Verified,"
android:textSize="32dp"
android:textStyle="bold"
android:textColor="#color/colorViews"
<!-- colorViews same color as framelayout background color it diappears but why?-->
android:padding="16dp"
android:layout_height="wrap_content">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:text="Sorry, We couldn't verify the mobile number ">
</TextView>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="#drawable/ic_icon_resentotp"
></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_marginStart="8dp"
android:text="Resend OTP"
android:layout_gravity="center_horizontal"
android:paddingBottom="16dp"
android:layout_height="wrap_content"></TextView>
</LinearLayout>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:background="#color/colorViews"
>
</View>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:src="#drawable/ic_icon_changemblno1"
android:layout_height="wrap_content">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:text="Change mobile number"
android:layout_height="wrap_content"></TextView>
</LinearLayout>
</LinearLayout>
</FrameLayout>
Well, If someone is still looking for an answer then I have it over here!!
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent">
<FrameLayout android:layout_width="match_parent"
android:background="#drawable/ic_img_bg"
android:alpha="0.1"
android:layout_height="match_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="#+id/linearlayout"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:text="Not Verified,"
android:textSize="32dp"
android:textStyle="bold"
android:textColor="#color/colorViews"
android:padding="16dp"
android:layout_height="wrap_content">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingBottom="16dp"
android:text="Sorry, We couldn't verify the mobile number ">
</TextView>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:layout_height="wrap_content">
<ImageView
android:layout_width="24dp"
android:layout_height="24dp"
android:src="#drawable/ic_icon_resentotp"
></ImageView>
<TextView
android:layout_width="wrap_content"
android:layout_marginStart="8dp"
android:text="Resend OTP"
android:layout_gravity="center_horizontal"
android:paddingBottom="16dp"
android:layout_height="wrap_content"></TextView>
</LinearLayout>
<View
android:layout_height="4dp"
android:layout_width="match_parent"
android:background="#color/colorViews"
>
</View>
<LinearLayout
android:layout_width="wrap_content"
android:orientation="horizontal"
android:paddingTop="16dp"
android:layout_height="wrap_content">
<ImageView
android:layout_width="wrap_content"
android:src="#drawable/ic_icon_changemblno1"
android:layout_height="wrap_content">
</ImageView>
<TextView
android:layout_width="wrap_content"
android:text="Change mobile number"
android:layout_height="wrap_content"></TextView>
</LinearLayout>
in my app, the TextView specified as R.id.text3 does cut off its content with half of a line being shown sometimes. Additionally, ellipsize is not working either. From the layout, do you see what I have to add so the Text is letting out the cut off line and (in the best case) ellipsizing at the end too?
If you might need my CursorAdapter code, please feel free to ask for it! I am by the way also defining a padding on the "linearLayout" to match the navigation bar.
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:airbnb="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="?android:attr/windowBackground"
android:foreground="?android:attr/selectableItemBackground"
android:id="#+id/baseRelativeLayout"
android:focusable="true"
android:clickable="true"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:id="#+id/linearLayout"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/relative_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:focusable="false"
android:clickable="false"
android:layout_marginTop="5dp"
android:minHeight="80dp">
<ImageView
android:id="#+id/main_icon"
android:layout_width="#dimen/entry_img_size"
android:layout_height="#dimen/entry_img_size"
android:layout_centerVertical="true"
app:shapeAppearance="#style/ShapeAppearance.Daily.MediumComponent"
android:layout_marginLeft="16dp"
android:clickable="true"
android:scaleType="centerCrop"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginBottom="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="15dp"
android:layout_marginTop="10dp"
android:id="#+id/titleLinearLayout"
android:layout_toRightOf="#+id/main_icon"
android:orientation="vertical">
<TextView
android:id="#android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:drawablePadding="3dp"
android:ellipsize="end"
android:gravity="top"
android:maxLines="3"
android:textSize="28sp"
android:textColor="?attr/contentColor"
android:clickable="true"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textIsSelectable="false"/>
<TextView
android:id="#android:id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:alpha="0.7"
android:textColor="?attr/contentColor"
android:drawablePadding="3dp"
android:singleLine="true"
android:clickable="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textIsSelectable="false"/>
</LinearLayout>
<com.airbnb.lottie.LottieAnimationView
android:id="#+id/favorite_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:paddingTop="10dp"
airbnb:lottie_fileName="star.json"
airbnb:lottie_scale="0.3"
airbnb:lottie_autoPlay="false"
airbnb:lottie_loop="false"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/imageView"
android:visibility="gone"
android:clickable="true"
android:layout_gravity="center_horizontal"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:layout_marginBottom="5dp"
android:maxHeight="500dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="16dp"
android:layout_marginRight="16dp"
android:focusable="true" />
<TextView
android:id="#+id/text3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="1dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:ellipsize="end"
android:textColor="?attr/contentColor"
android:textSize="18sp"
android:focusable="false"
android:clickable="false"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textIsSelectable="false"/>
</LinearLayout>
You have to put your LinearLayout(linearLayout) inside a ScrollView
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:orientation="vertical"
android:id="#+id/linearLayout"
android:layout_height="match_parent">
<....
....>
</LinearLayout>
</ScrollView>
for ellipsize, try to add android:maxlines.
for the cut line, you need to use a scrollview i think.
I have recyclerview and for that, I use a specific view. In that view, I have 3 textviews and an image button. First textview shows me numbers. Others some dummy text. And when my numbers exceed 10(2 characters) everything except numbers moves to the right. How can I handle this?
Here is my xml file:
<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="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<LinearLayout
android:id="#+id/linlay"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="#+id/buses_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textSize="25dp"
android:textColor="#color/gradStop"
android:layout_marginLeft="15dp"/>
<LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/buses_route_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Bus Route"
android:textColor="#color/gradStart"
android:textSize="20dp"/>
<TextView
android:id="#+id/buses_cycle_duration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Duration"
android:textColor="#color/gradStop"
android:textSize="20dp"/>
</LinearLayout>
<ImageButton
android:id="#+id/buses_favourites"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/ic_favorite_border_black_24dp"
android:background="#color/transparent"
android:layout_alignParentRight="true"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
Here is the screenshot how it looks like:
Try giving layout_weight since you are using linear layout
<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="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<LinearLayout
android:id="#+id/linlay"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="#+id/buses_number"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="1"
android:layout_weight = "0.3"
android:textSize="25dp"
android:textColor="#color/gradStop"
android:layout_marginLeft="15dp"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight = "0.6"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/buses_route_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Bus Route"
android:textColor="#color/gradStart"
android:textSize="20dp"/>
<TextView
android:id="#+id/buses_cycle_duration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Duration"
android:textColor="#color/gradStop"
android:textSize="20dp"/>
</LinearLayout>
<ImageButton
android:id="#+id/buses_favourites"
android:layout_width="0dp"
android:layout_weight = "0.1"
android:layout_height="30dp"
android:src="#drawable/ic_favorite_border_black_24dp"
android:background="#color/transparent"
android:layout_alignParentRight="true"/>
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
As you can see 30% space of screen width will be taken by your TextView and 60 % will be taken by Other (LinearLayout) and 10% by your ImageView. I am sure you can change the weight according to your design as you get the gist :)
Just set weight 1 to middle Linear layout and set wrap_content for remaining two layout.
<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="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<LinearLayout
android:id="#+id/linlay"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="#+id/buses_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="10"
android:textSize="25dp"
android:textColor="#000000"
android:layout_marginLeft="15dp"/>
<LinearLayout
android:layout_width="0dp"
android:layout_weight = "1"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/buses_route_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Bus Route"
android:textColor="#000000"
android:textSize="20dp"/>
<TextView
android:id="#+id/buses_cycle_duration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Duration"
android:textColor="#000000"
android:textSize="20dp"/>
</LinearLayout>
<ImageButton
android:id="#+id/buses_favourites"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"/>
</LinearLayout>
</RelativeLayout>
Your ImageButton attribute android:layout_alignParentRight="true" is not working in linear layout so put outside LinearLayout of ImageButton.
Like this and its wo0rking fine for you.
<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="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp">
<LinearLayout
android:id="#+id/linlay"
android:layout_width="match_parent"
android:layout_height="70dp"
android:orientation="horizontal"
android:gravity="center_vertical">
<TextView
android:id="#+id/buses_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="1"
android:textSize="25dp"
android:textColor="#color/gradStop"
android:layout_marginLeft="15dp"/>
<LinearLayout
android:layout_width="300dp"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="#+id/buses_route_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Bus Route"
android:textColor="#color/gradStart"
android:textSize="20dp"/>
<TextView
android:id="#+id/buses_cycle_duration"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="30dp"
android:text="Duration"
android:textColor="#color/gradStop"
android:textSize="20dp"/>
</LinearLayout>
</LinearLayout>
<ImageButton
android:id="#+id/buses_favourites"
android:layout_width="30dp"
android:layout_height="30dp"
android:src="#drawable/ic_favorite_border_black_24dp"
android:background="#color/transparent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"/>
</RelativeLayout>
</RelativeLayout>
And whenever you used wrap_content it used this property for textView
android:ellipsize="end"
I have LinearLayout inside that relataive layout is there. I want to keep RelativeLayout right side of the LinearLayout. How to do this one. below is my code
<LinearLayout android:id="#+id/status_bar_contents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="6dp"
android:paddingEnd="8dp"
android:orientation="horizontal">
<com.android.keyguard.AlphaOptimizedLinearLayout android:id="#+id/system_icon_area"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/network"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:layout_marginRight="20dp"
android:background="#drawable/network_strength_0"/>
<com.android.systemui.statusbar.policy.Clock
android:id="#+id/clock"
android:textAppearance="#style/TextAppearance.StatusBar.Clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:singleLine="true"
android:gravity="center"
android:layout_toRightOf="#id/network"
/>
</RelativeLayout>
</com.android.keyguard.AlphaOptimizedLinearLayout>
</LinearLayout>
use this one
<LinearLayout android:id="#+id/status_bar_contents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="6dp"
android:paddingEnd="8dp"
android:orientation="horizontal">
<com.android.keyguard.AlphaOptimizedLinearLayout android:id="#+id/system_icon_area"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="horizontal">
</com.android.keyguard.AlphaOptimizedLinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/network"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:layout_marginRight="20dp"
android:background="#drawable/network_strength_0"/>
<com.android.systemui.statusbar.policy.Clock
android:id="#+id/clock"
android:textAppearance="#style/TextAppearance.StatusBar.Clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:singleLine="true"
android:gravity="center"
android:layout_toRightOf="#id/network"
/>
</RelativeLayout>
</LinearLayout>
Note:-Weight is divide you parent LinearLayout into 2 View with same space .IF you want space between 2 views that put weight in ratio....
# Shiv you can try this ..hope this can help you,,
<LinearLayout android:id="#+id/status_bar_contents"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingStart="6dp"
android:paddingEnd="8dp"
android:weightSum="1"
android:orientation="horizontal">
<com.android.keyguard.AlphaOptimizedLinearLayout android:id="#+id/system_icon_area"
android:layout_width="0dp"
android:layout_weight=".5"
android:layout_height="match_parent">
</com.android.keyguard.AlphaOptimizedLinearLayout>
<RelativeLayout
android:layout_width="0dp"
android:layout_weight=".5"
android:layout_height="wrap_content">
<ImageView
android:id="#+id/network"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:gravity="center"
android:layout_marginRight="20dp"
android:background="#drawable/network_strength_0"/>
<com.android.systemui.statusbar.policy.Clock
android:id="#+id/clock"
android:textAppearance="#style/TextAppearance.StatusBar.Clock"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:singleLine="true"
android:gravity="center"
android:layout_toRightOf="#id/network"/>
</RelativeLayout>
</LinearLayout>
Below is my XML code, I want the whole view to scroll, but it's just not working, please help, with what's wrong;
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/app_icon"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="#+id/textView_app_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_gravity="center"/>
<TextView
android:id="#+id/textView_content"
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:layout_height="386dp"
android:gravity="center"></TextView>
</LinearLayout>
</ScrollView>
I've tried using,
android:fillViewport="true"
but of no help.
A ScrollView is a FrameLayout, meaning you should place one child in it containing the entire contents to scroll; this child may itself be a layout manager with a complex hierarchy of objects.
So here you have to take LinearLayout or RelativeLayout and then you have to put different hierarchy of component.
Android : buttons not visible in scrollview
here i have given answer of Some problem so you can follow this for solve your problem with clearing your concept.
Try like this ,Scrolling will work till End
<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="match_parent">
<ScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/app_icon"
android:layout_marginTop="20dp"
android:layout_gravity="center_horizontal"/>
<TextView
android:id="#+id/textView_app_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_gravity="center"/>
<TextView
android:id="#+id/textView_content"
android:layout_width="match_parent"
android:layout_marginTop="15dp"
android:layout_height="386dp"
android:gravity="center"/>
</LinearLayout>
</ScrollView>
</Relativelayout>
If ScrollView fits to your device screen it would not be scrollable, so make sure content inside ScrollView takes space larger than your screen size.
systematix Try this,here you getting scroll.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/textView_app_version1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="hello" />
<TextView
android:id="#+id/textView_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:text="fahfhahffshfs fsfhshf fshfs sflshf sflsh fhsfhslfh fshflshf hslfh slfhslfhslfhs fhslhf"></TextView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/textView_app_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="hello" />
<TextView
android:id="#+id/textView_content1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:text="fahfhahffshfs fsfhshf fshfs sflshf sflsh fhsfhslfh fshflshf hslfh slfhslfhslfhs fhslhf"></TextView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/textView_app_version2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="hello" />
<TextView
android:id="#+id/textView_content3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:text="fahfhahffshfs fsfhshf fshfs sflshf sflsh fhsfhslfh fshflshf hslfh slfhslfhslfhs fhslhf"></TextView>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="20dp"
android:src="#mipmap/ic_launcher" />
<TextView
android:id="#+id/textView_app_version4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="20dp"
android:text="hello" />
<TextView
android:id="#+id/textView_content4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:gravity="center"
android:text="fahfhahffshfs fsfhshf fshfs sflshf sflsh fhsfhslfh fshflshf hslfh slfhslfhslfhs fhslhf"></TextView>
</LinearLayout>