Android ScrollView is not scrolling with a relative layout - java

I have the following xml layout but my scrollview is not scrolling when I run the app. What am I doing wrong? I am trying to use a Relative layout in the scrollview instead of a Linear Layout Here is the xml..
<ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/main_title"
android:textSize="30sp"
android:textStyle="bold"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<ImageView
android:layout_width="180dp"
android:layout_height="270dp"
android:id="#+id/movie_poster"
android:layout_weight="0.59"
android:layout_below="#+id/main_title"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Ratings:"
android:id="#+id/textView"
android:layout_alignTop="#+id/movie_poster"
android:layout_toRightOf="#+id/movie_poster"
android:layout_toEndOf="#+id/movie_poster"
android:layout_marginLeft="52dp"
android:layout_marginStart="52dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=" 6.5"
android:textStyle="bold"
android:id="#+id/movie_rating"
android:layout_alignTop="#+id/textView"
android:layout_toRightOf="#+id/textView"
android:layout_toEndOf="#+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=" 2015-01-01"
android:textStyle="bold"
android:id="#+id/movie_release_date"
android:layout_below="#+id/textView"
android:layout_alignLeft="#+id/textView" />
<TextView
android:layout_width="wrap_content"
android:layout_height="180dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Medium Text"
android:id="#+id/movie_description"
android:layout_below="#+id/movie_poster"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
</RelativeLayout>
</ScrollView>

That is because you set the height of the ScrollView to fill_parent.
Try using a LinearLayout with weight so it fills the space left over from the other views.
If you do not want to set it to a specific height, you can also add
android:fillViewport="true"
to your ScrollView

Related

why doesn't my banner appear in Linearlayout?

I am using relative layout in linear layout.My banner appears on the design screen, but no ads appear when I run my application.I looked at many examples but I could not find.My application was horizontal before now I'm designing vertically.Previously I was using Relativelayout then my banner was working.Here my code;
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
tools:context=".MainActivity"
android:orientation="vertical"
android:weightSum="12"
android:background="#fffdd0">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="2">
<RelativeLayout
android:layout_width="150dp"
android:layout_height="match_parent"
android:layout_centerHorizontal="true">
<Button
android:id="#+id/btn_double"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentStart="true"
android:background="#drawable/xx"
android:layout_marginTop="15dp"/>
<Button
android:id="#+id/btn_yariyariya"
android:layout_width="47dp"
android:layout_height="47dp"
android:background="#drawable/fiftyfifty"
android:layout_centerHorizontal="true"
android:layout_marginTop="15dp"/>
<Button
android:id="#+id/btn_skip"
android:layout_width="45dp"
android:layout_height="45dp"
android:layout_alignParentEnd="true"
android:background="#drawable/skip"
android:layout_marginTop="15dp"/>
<TextView
android:id="#+id/tv_countdown2x"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:layout_alignParentStart="true"
android:textColor="#color/colorPrimary"
android:layout_below="#+id/btn_double" />
<TextView
android:id="#+id/tv_countdown50"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:layout_centerHorizontal="true"
android:textColor="#color/colorPrimary"
android:layout_below="#+id/btn_yariyariya"/>
<TextView
android:id="#+id/tv_countdownNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="13sp"
android:layout_alignParentEnd="true"
android:textColor="#color/colorPrimary"
android:layout_below="#+id/btn_skip"/>
<TextView
android:id="#+id/tv_countdown"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="00:30"
android:textSize="30sp"
android:layout_centerHorizontal="true"
android:textColor="#color/colorPrimary"
android:layout_marginTop="85dp" />
<FrameLayout
android:id="#+id/container_pop_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="16dp" />
</RelativeLayout>
<TextView
android:id="#+id/tv_countdown1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:layout_marginStart="40dp"
android:layout_marginTop="60dp"
android:textColor="#color/colorPrimary"/>
<Button
android:id="#+id/btn_kalp1"
android:layout_width="50dp"
android:layout_height="40dp"
android:background="#drawable/kalp"
android:layout_alignParentStart="true"
android:layout_marginStart="30dp"
android:layout_marginTop="15dp"/>
<Button
android:id="#+id/btn_satinal"
android:layout_width="50dp"
android:layout_height="40dp"
android:layout_marginStart="200dp"
android:onClick="satinalMain"
android:background="#drawable/satinal"
android:layout_alignParentEnd="true"
android:layout_marginEnd="30dp"
android:layout_marginTop="15dp"/>
<TextView
android:id="#+id/tv_kalp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp"
android:text="5"
android:textColor="#color/colorPrimary"
android:layout_alignParentStart="true"
android:layout_marginTop="25dp"
android:layout_marginStart="84dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="10sp"
android:text="X"
android:textColor="#color/colorPrimary"
android:layout_alignParentStart="true"
android:layout_marginTop="35dp"
android:layout_marginStart="77dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="3">
<TextView
android:id="#+id/tv_soru"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="#000"
android:fontFamily="#font/incee"
android:gravity="center"
android:layout_alignParentEnd="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="5dp"
android:layout_marginEnd="5dp"
android:textAlignment="gravity"
android:textSize="18sp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="5"
android:orientation="vertical">
<Button
android:id="#+id/btn_a"
android:layout_width="260dp"
android:layout_height="60dp"
android:textColor="#000"
android:background="#drawable/gradient"
android:gravity="center"
android:textAlignment="gravity"
android:fontFamily="#font/incee"
android:textSize="12sp"
android:layout_centerHorizontal="true"/>
<Button
android:id="#+id/btn_b"
android:layout_width="260dp"
android:layout_height="60dp"
android:layout_below="#+id/btn_a"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"
android:background="#drawable/gradient"
android:fontFamily="#font/incee"
android:gravity="center"
android:textAlignment="gravity"
android:textColor="#000"
android:textSize="12sp" />
<Button
android:id="#+id/btn_c"
android:layout_width="260dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:background="#drawable/gradient"
android:fontFamily="#font/incee"
android:gravity="center"
android:textAlignment="gravity"
android:textColor="#000"
android:textSize="12sp"
android:layout_below="#+id/btn_b"
android:layout_marginTop="5dp"/>
<Button
android:id="#+id/btn_d"
android:layout_width="260dp"
android:layout_height="60dp"
android:textColor="#000"
android:background="#drawable/gradient"
android:gravity="center"
android:textAlignment="gravity"
android:fontFamily="#font/incee"
android:textSize="12sp"
android:layout_below="#+id/btn_c"
android:layout_centerHorizontal="true"
android:layout_marginTop="5dp"/>
<Button
android:id="#+id/btn_infoA"
android:layout_width="40dp"
android:layout_height="45dp"
android:background="#drawable/info"
android:layout_centerVertical="true"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"/>
<Button
android:id="#+id/btn_gec"
android:layout_width="65dp"
android:layout_height="60dp"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:layout_marginEnd="1dp"
android:background="#drawable/next"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<TextView
android:id="#+id/tv_skor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="25sp"
android:text="0"
android:textColor="#000"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="25dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="15sp"
android:textStyle="bold"
android:text="SKOR :"
android:textColor="#000"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginEnd="50dp"
android:layout_marginBottom="5dp"/>
<Button
android:id="#+id/btn_reklam"
android:layout_width="50dp"
android:layout_height="45dp"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="5dp"
android:background="#drawable/plus"
android:onClick="startVideoAd"/>
<TextView
android:id="#+id/tv_kalp_kazan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="İzle Kazan"
android:layout_alignParentStart="true"
android:textSize="15sp"
android:textStyle="bold"
android:layout_alignParentBottom="true"
android:fontFamily="#font/incee"
android:textColor="#000"
android:layout_marginStart="55dp"
android:layout_marginBottom="5dp"/>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1">
<com.google.android.gms.ads.AdView
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
ads:adUnitId="ca-app-pub-3101578796185185/4912585915">
</com.google.android.gms.ads.AdView>
</RelativeLayout>
I think it's because the bannerview is lower than your screen! (Maybe you're using this layout for a fragment and your activity has a toolbar, am I right?)
Just put LinearLayout inside a ScrollView and see if it works.
Your layout design is not very well done, the buttons at the center (first RelativeLayout) are not constrained to the adjacent buttons, so they may overlap.
You should use a ConstraintLayout instead of RelativeLayout, the later is obsolete now.
You have several items with wrap_content height inside a layout that you want to stretch vertically, which is contradictory. This may cause views inside the inner RelativeLayouts to be hidden if they are smaller than the height.
weightSum is a property that is rarely useful because weights are calculated automatically, you should simply know that two views with 1 and 1 with use 50% each, and if you add another with weight 2 it will have proportionally that weight. So it will end up 25%, 25% and 50%.
There is no need to place the AdView inside a RelativeLayout if it is the only view there.
If you want the banner to be always visible, then simply place a default height (either wrap_content or a given height in dps). The other views will use the remaining space to calculate the weight space.
I recommend you to first study how different Layouts work before attempting to build your screen layout.
On the other hand, the AdView requires some additional configuration on your end to become shown, because if you did not setup some campaign to be shown, the view won't display anything.

Layout larger than device screen causes app to crash

I am currently having an issue with a mobile app I am developing. The idea behind it being it displays the value of various variables from a passed object. As I have needed to add more and more objects to the layout xml file in order to display everything, the preview has since stopped displaying any objects besides the action bar and trying to start the activity using this layout crashes the app.
I have a feeling this may be due to the layout being larger than the virtual device screen, though there could be another cause i'm totally unaware of. Any help in this matter would be appreciated. This activity currently uses the Relative layout, would it resolve the issue to wrap the Relative layout in a Scrollview to make the activity scrollable?
<?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="match_parent"
android:paddingBottom="16dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="16dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Name"
android:id="#+id/RequestNameTextView"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
<TextView
android:id="#+id/RequestNameDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestNameTextView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Student ID"
android:id="#+id/RequestStudentIDTextView"
android:layout_below="#+id/RequestNameDisplay"/>
<TextView
android:id="#+id/RequestStudentIDDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestStudentIDTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/RequestLocationTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestStudentIDDisplay"
android:text="Location"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:id="#+id/RequestLocationDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestLocationTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/RequestProblemTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestLocationDisplay"
android:text="Problem Description"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:id="#+id/RequestProblemDisplay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestProblemTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="#+id/RequestStatusTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestProblemDisplay"
android:text="Current Status"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/RequestStatusDisplay"
android:layout_below="#+id/RequestStatusTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="#+id/RequestAssignmentTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestStatusDropDown"
android:text="Assigned To"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/RequestAssignmentDisplay"
android:layout_below="#+id/RequestAssignmentTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="#+id/RequestStatusUpdateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestAssignmentDisplay"
android:text="Update Status to:"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/RequestStatusDropDown"
android:layout_below="#+id/RequestStatusUpdateTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<TextView
android:id="#+id/RequestAssignmentUpdateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/RequestStatusDropDown"
android:text="Assign Request To:"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/RequestAssignmentDropDown"
android:layout_below="#+id/RequestAssignmentUpdateTextView"
android:layout_margin="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"/>
<Button
android:id="#+id/RequestSaveChangesButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="Save Changes" />
</RelativeLayout>
It is because your Relative Layout having Circular dependencies. From RequestAssignmentTextView to RequestStatusDropDown, your are having a circular dependency. Just change your 'below' element of RequestAssignmentTextView to avoid this error.

Align views in a relative layout to the bottom of the screen

I am trying to align a text area with username and phone along with a button to the bottom of the screen by adding margin-top on id with
android:id="#+id/textView1"
attribute but no effect as shown in the following snippet
<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"
>
<ImageView
android:id="#+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/textView2"
android:layout_centerHorizontal="true"
android:src="#drawable/ic_launcher"
/>
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/phone"
android:layout_centerVertical="true"
android:text="Username"
/>
<EditText
android:id="#+id/username"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/textView1"
android:layout_below="#+id/textView1"
android:ems="10" />
<TextView
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/username"
android:layout_below="#+id/username"
android:text="Phone No" />
<TextView
android:id="#+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_marginTop="16dp"
android:gravity="center"
android:text=" User Registration"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textStyle="bold" />
<EditText
android:id="#+id/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/TextView01"
android:layout_centerHorizontal="true"
android:ems="10"/>
<Button
android:id="#+id/register"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="#+id/phone"
android:layout_below="#+id/phone"
android:text="Register" />
</RelativeLayout>
The screen below shows the output
I want from the username textview down to the register button to be align to the bottom of the screen. I have tried adding margin but did not work
Did you try to use a relative layout.
If you have a relative layout that fills the whole screen you should be able to use android:layout_alignParentBottom to move the button to the bottom of the screen.

TextView not showing full text in Relative Layout

I want to change text of Textview dynamically,
but it does not show full text.instead it shw one or two character less than it or sometimes show "...." atlast.
This is a layout for an custom equalizer.
This is my xml file.
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="#+id/fullscreenlnearlayout"
android:paddingLeft="10dp"
android:paddingRight="10dp">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="0.38"
android:gravity="center" >
<Button
android:id="#+id/btnformenu"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:text="Create New..." />
<ImageButton
android:id="#+id/refresh"
android:contentDescription="Reset Equalizer to Default"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_margin="20dp"
android:adjustViewBounds="false"
android:alpha=".4"
android:src="#drawable/refresh"
android:layout_marginTop="10dp"
android:textAppearance="?android:attr/textAppearanceLarge" />
<ToggleButton
android:id="#+id/exit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignTop="#+id/refresh"
android:layout_marginRight="15dp"
android:layout_marginEnd="15dp"
android:alpha=".4" />
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:id="#+id/horizontalscrollforequaliser"
android:layout_height="0dp"
android:isScrollContainer="false"
android:layout_weight="1">
<TextView
android:id="#+id/seekbar1kabottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="60Hz" />
<include
android:id="#+id/include5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekbar1kabottom"
android:layout_alignTop="#+id/include7"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_centerHorizontal="true"
layout="#layout/eq_bar" />
<TextView
android:id="#+id/seekbar3katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:singleLine="true"
android:text="0mB" />
<TextView
android:id="#+id/seekbar3kabottom"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="910Hz" />
<include
android:id="#+id/include7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekbar3kabottom"
android:layout_alignParentLeft="true"
android:layout_below="#+id/seekbar3katop"
layout="#layout/eq_bar" />
<include
android:id="#+id/include"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/seekbar5kabottom"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignTop="#+id/include4"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginStart="10dp"
layout="#layout/eq_bar" />
<include
android:id="#+id/include4"
android:layout_marginStart="10dp"
android:layout_marginLeft="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/include5"
android:layout_alignTop="#+id/include6"
android:layout_toStartOf="#+id/include"
android:layout_toLeftOf="#+id/include"
layout="#layout/eq_bar" />
<TextView
android:id="#+id/seekbar4katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include4"
android:layout_alignStart="#+id/include4"
android:layout_alignEnd="#+id/seekbar4kabottom"
android:layout_alignLeft="#+id/include4"
android:layout_alignRight="#+id/seekbar4kabottom"
android:singleLine="false"
android:text="0mB"/>
<TextView
android:id="#+id/seekbar5kabottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:singleLine="true"
android:layout_below="#+id/include4"
android:text="14KHz" />
<TextView
android:id="#+id/seekbar4kabottom"
android:singleLine="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignStart="#+id/include4"
android:layout_alignLeft="#+id/include4"
android:layout_below="#+id/include4"
android:text="3600Hz" />
<TextView
android:id="#+id/seekbar2kabottom"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="#+id/include6"
android:layout_alignParentBottom="true"
android:singleLine="true"
android:text="230Hz" />
<TextView
android:id="#+id/seekbar2katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include6"
android:layout_alignEnd="#+id/seekbar2kabottom"
android:layout_alignLeft="#+id/include6"
android:layout_alignParentTop="true"
android:layout_alignRight="#+id/seekbar2kabottom"
android:singleLine="false"
android:text="0mB" />
<include
android:id="#+id/include6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/include7"
android:layout_below="#+id/seekbar1katop"
android:layout_marginStart="15dp"
android:layout_marginLeft="15dp"
android:layout_toRightOf="#+id/include7"
layout="#layout/eq_bar" />
<TextView
android:id="#+id/seekbar5katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include"
android:layout_alignLeft="#+id/seekbar5kabottom"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_alignStart="#+id/include"
android:singleLine="false"
android:text="0mB" />
<TextView
android:id="#+id/seekbar1katop"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/include7"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="#+id/include7"
android:singleLine="false"
android:text="0mB" />
</RelativeLayout>
</LinearLayout>
In picture you can see text s not coming u fully....it is not showing mB (unit) atlast.
I am trying this from several hours,but unable to do this
Please give me a way to achieve this .
Thans in advance :)
You can decrease the text size of the TextView and see the changes. Ideally Android design guidelines specify that you create separate layouts for different screen sizes and resolutions. So on some devices the TextView font size would just fit fine but for others it'd have to be adjusted
You can decrease Text size of the TextView .
If you want remove .... You can remove this line
android:singleLine="true"
and set width as match_parent or fill_parent .
Remove wrap content and set a size using dp, it will probably work

why is android:layout_above doesn't work in

I have this layout
<ListView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/comments_list" android:layout_gravity="center"
android:layout_below="#+id/phone_editText" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" android:layout_above="#+id/bottom_container"
android:layout_alignRight="#+id/search_btn" android:layout_alignEnd="#+id/search_btn"/>
<AutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/phone_editText"
android:hint="enter phone"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="blocked"
android:id="#+id/isBlocked_cb"
android:layout_toStartOf="#+id/phone_editText"
android:layout_toLeftOf="#+id/phone_editText"
android:layout_above="#+id/comments_list"
android:checked="true" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="search"
android:id="#+id/search_btn"
android:layout_toEndOf="#+id/phone_editText"
android:layout_toRightOf="#+id/phone_editText"
android:layout_above="#+id/comments_list"
android:layout_alignParentTop="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:onClick="foo"/>
<RelativeLayout android:id="#+id/bottom_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true">
<AutoCompleteTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/comment_text"
android:hint="enter comment"
android:layout_alignParentBottom="true" android:layout_centerHorizontal="true"/>
<Button style="?android:attr/buttonStyleSmall" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Add" android:id="#+id/add_btn"
android:layout_alignParentBottom="true"
android:layout_toRightOf="#+id/comment_text" android:layout_alignTop="#+id/comment_text"/>
</RelativeLayout>
<LinearLayout
android:focusable="true" android:focusableInTouchMode="true"
android:layout_width="0px" android:layout_height="0px"/>
</RelativeLayout>
I want bottom_container to be below my ListView
but in the simulator they seems one above the other:
Your question it's pretty incomplete, but I see some potential error in your xml about "above"
For example
android:layout_above="#+id/comments_list"
android:layout_alignParentTop="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" android:onClick="foo"/>
This is an error, you can not declare align parent top and end togheter... and in any case, If I'm right, those ovverride layout_above.

Categories