How to decrease the space between column - java

I have this table:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="369dp"
android:layout_height="118dp"
android:layout_marginTop="224dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="A:" />
<TextView
android:id="#+id/q2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="15%" />
<TextView
android:id="#+id/q3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?attr/editTextBackground"
android:layout_weight="1.5"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:textColor="#000000" />
<TextView
android:id="#+id/q4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="20%" />
<TextView
android:id="#+id/q5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
<TextView
android:id="#+id/q6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="25%" />
<TextView
android:id="#+id/q7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="B:" />
<TextView
android:id="#+id/a2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="15%" />
<TextView
android:id="#+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
<TextView
android:id="#+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="20%" />
<TextView
android:id="#+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
<TextView
android:id="#+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="25%" />
<TextView
android:id="#+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000"
/>
</TableRow>
</TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
How to make the columns closer together?
To make less space between 15% and underscore?

Used below codes
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TableLayout
android:id="#+id/tableLayout"
android:layout_width="369dp"
android:layout_height="118dp"
android:layout_marginTop="224dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/q1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="A:" />
<TextView
android:id="#+id/q2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="15%" />
<TextView
android:id="#+id/q3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:clickable="false"
android:cursorVisible="false"
android:focusable="false"
android:textColor="#000000" />
<TextView
android:id="#+id/q4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="20%" />
<TextView
android:id="#+id/q5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
<TextView
android:id="#+id/q6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="25%" />
<TextView
android:id="#+id/q7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/a1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.8"
android:text="B:" />
<TextView
android:id="#+id/a2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="15%" />
<TextView
android:id="#+id/b1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
<TextView
android:id="#+id/b2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="20%" />
<TextView
android:id="#+id/b3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
<TextView
android:id="#+id/b4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.3"
android:gravity="center"
android:text="25%" />
<TextView
android:id="#+id/b5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="?attr/editTextBackground"
android:textColor="#000000" />
</TableRow>
</TableLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Output :

Related

Android CoordinatorLayout Scrolling Entire View

I have a ViewPager activity that uses CoordinatorLayout and a couple of tabs. In each tab, I have these pretty large Fragments that will not fit all the way onto a user's screen. I want the user to be able to scroll up and down to see the entire Fragment. I obviously also want the scroll events to be picked up by CoordinatorLayout which will hide the Toolbar. I have the Toolbar hiding on scroll working, but after the Toolbar is hidden from the CoordinatorLayout scroll, I cannot scroll anymore to see the rest of my view below.
How can I get this behavior?
Here is my simple ViewPager activity layout
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.currencylist.CurrencyListTabsActivity"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="#+id/appBarLayout"
android:theme="#style/ThemeOverlay.AppCompat.Dark.ActionBar">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar_currency_details"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
app:popupTheme="#style/ThemeOverlay.AppCompat.Light"
app:layout_scrollFlags="scroll|enterAlways|snap"/>
<android.support.design.widget.TabLayout
android:id="#+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</android.support.design.widget.AppBarLayout>
<android.support.v4.view.ViewPager
android:id="#+id/currencyTabsViewPager"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
app:layout_behavior="#string/appbar_scrolling_view_behavior"/>
Here is my Fragment layout that I cannot for the life of me get to scroll:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView 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="com.cryptobuddy.ryanbridges.cryptobuddy.chartandprice.CurrencyDetailsTabsActivity"
app:layout_behavior="#string/appbar_scrolling_view_behavior"
android:fillViewport="true">
<android.support.v4.widget.SwipeRefreshLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/swipe_refresh_layout"
android:layout_gravity="center|bottom"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.constraint.ConstraintLayout 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="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/graph_fragment_horizontal_margin"
android:paddingRight="#dimen/graph_fragment_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context="com.cryptobuddy.ryanbridges.cryptobuddy.chartandprice.CurrencyDetailsTabsActivity">
<TextView
android:id="#+id/current_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/graphFragmentDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.501"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/current_price" />
<TextView
android:id="#+id/percent_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/graphFragmentDateTextView" />
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/chart"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:layout_marginEnd="2dp"
android:layout_marginStart="2dp"
android:focusableInTouchMode="true"
android:padding="0dp"
app:layout_constraintBottom_toTopOf="#+id/guideline5"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="#+id/guideline6" />
<com.nex3z.togglebuttongroup.SingleSelectToggleGroup
android:id="#+id/chart_interval_button_grp"
android:layout_width="384dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintBottom_toTopOf="#+id/guideline6"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/percent_change"
app:tbgCheckedButton="#+id/dayButton"
app:tbgChildSpacing="auto">
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/dayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/oneDay"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/weekButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Week"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/monthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Month"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/threeMonthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/threeMonth"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/yearButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Year"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/allTimeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/All"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
</com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
<android.support.constraint.Guideline
android:id="#+id/guideline5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.5" />
<android.support.constraint.Guideline
android:id="#+id/guideline6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
app:layout_constraintGuide_percent="0.15" />
<TableLayout
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/guideline5">
<TableRow
android:id="#+id/nameTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableNameTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Name" />
<TextView
android:id="#+id/tableNameDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/symbolTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableSymbolTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Symbol" />
<TextView
android:id="#+id/tableSymbolDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tablePriceUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price (USD)" />
<TextView
android:id="#+id/tablePriceUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceBTCTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tablePriceBTCTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Price (BTC)" />
<TextView
android:id="#+id/tablePriceBTCDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/volUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableVolUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="24h Volume" />
<TextView
android:id="#+id/tableVolUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/mktCapUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableMktCapTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Market Cap" />
<TextView
android:id="#+id/tableMktCapDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/availableSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableAvailableSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Available Supply" />
<TextView
android:id="#+id/tableAvailableSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/totalSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableTotalSupplyTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Total Supply" />
<TextView
android:id="#+id/tableTotalSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/maxSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableMaxSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Max Supply" />
<TextView
android:id="#+id/tableMaxSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/changeTitlesTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/table1hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Change 1hr"
android:textAlignment="center" />
<TextView
android:id="#+id/table24hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="Change 24hr"
android:textAlignment="center" />
<TextView
android:id="#+id/tableWeekChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="Change 7d"
android:textAlignment="center" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/table1hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="TextView"
android:textAlignment="center" />
<TextView
android:id="#+id/table24hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:text="TextView"
android:textAlignment="center" />
<TextView
android:id="#+id/table7dChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:text="TextView"
android:textAlignment="center" />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>
</ScrollView>
</android.support.v4.widget.SwipeRefreshLayout>
From your fragment code:
Remove the outermost NestedScrollView. You don't need it.
Add app:layout_behavior="#string/appbar_scrolling_view_behavior" to the SwipeRefreshLayout which has become the new parent.
Change the inner ScrollView to NestedScrollView.
Let us know if it works.
I found the solution. There were 2 problems:
I was using guidelines in the ConstraintLayout.
I had the height/width of some elements in my ConstraintLayout set to match_constraint.
I removed the guidelines and gave all of my layout elements raw height/width values in dp. That seems to have fixed the problem.
It seems that the scrolling does not play nicely fitting elements inside of guidelines
Here is my xml now:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/graphFragmentNestedScrollView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
app:layout_behavior="#string/appbar_scrolling_view_behavior">
<android.support.constraint.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="#dimen/graph_fragment_horizontal_margin"
android:paddingRight="#dimen/graph_fragment_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin">
<TextView
android:id="#+id/current_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="#+id/graphFragmentDateTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/current_price" />
<TextView
android:id="#+id/percent_change"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:textSize="12sp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/graphFragmentDateTextView" />
<com.nex3z.togglebuttongroup.SingleSelectToggleGroup
android:id="#+id/chart_interval_button_grp"
android:layout_width="362dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/percent_change"
app:tbgCheckedButton="#+id/dayButton"
app:tbgChildSpacing="auto">
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/dayButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/oneDay"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/weekButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Week"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/monthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Month"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/threeMonthButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/threeMonth"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/yearButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/Year"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
<com.nex3z.togglebuttongroup.button.CircularToggle
android:id="#+id/allTimeButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/All"
android:textSize="16sp"
app:tbgMarkerColor="#color/colorAccent" />
</com.nex3z.togglebuttongroup.SingleSelectToggleGroup>
<com.github.mikephil.charting.charts.LineChart
android:id="#+id/chart"
android:layout_width="match_parent"
android:layout_height="275dp"
android:layout_marginTop="8dp"
android:focusableInTouchMode="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/chart_interval_button_grp" />
<TableLayout
android:id="#+id/tableLayoutGraphFragment"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:paddingBottom="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="#+id/chart">
<TableRow
android:id="#+id/nameTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tableNameTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Name" />
<TextView
android:id="#+id/tableNameDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tablePriceUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Price (USD)" />
<TextView
android:id="#+id/tablePriceUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/priceBTCTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tablePriceBTCTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Price (BTC)" />
<TextView
android:id="#+id/tablePriceBTCDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/volUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableVolUSDTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="24h Volume" />
<TextView
android:id="#+id/tableVolUSDDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/mktCapUSDTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tableMktCapTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Market Cap" />
<TextView
android:id="#+id/tableMktCapDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/availableSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableAvailableSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Available Supply" />
<TextView
android:id="#+id/tableAvailableSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/totalSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/tableTotalSupplyTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Total Supply" />
<TextView
android:id="#+id/tableTotalSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/maxSupplyTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tableMaxSupplyTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Max Supply" />
<TextView
android:id="#+id/tableMaxSupplyDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="textEnd" />
</TableRow>
<TableRow
android:id="#+id/changeTitlesTableRow"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/table1hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingStart="8dp"
android:text="Change 1hr"
android:textAlignment="center" />
<TextView
android:id="#+id/table24hrChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingStart="8dp"
android:text="Change 24hr"
android:textAlignment="center" />
<TextView
android:id="#+id/tableWeekChangeTitleTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingStart="8dp"
android:text="Change 7d"
android:textAlignment="center" />
</TableRow>
<TableRow
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/lightGray">
<TextView
android:id="#+id/table1hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingEnd="8dp"
android:textAlignment="center"
android:textStyle="bold" />
<TextView
android:id="#+id/table24hrChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="2"
android:paddingEnd="8dp"
android:textAlignment="center"
android:textStyle="bold" />
<TextView
android:id="#+id/tableWeekChangeDataTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="3"
android:paddingEnd="8dp"
android:textAlignment="center"
android:textStyle="bold" />
</TableRow>
</TableLayout>
</android.support.constraint.ConstraintLayout>

How can I get this interface?

I'm debutant in android and I want to get an interface like this but I couldn't place my linearlayout interface
I tried to use a horizontal and a vertical linearlayout but it doesn't work
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"><TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:id="#+id/txt1"
android:text="AAAAAAAA"/><Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BE"
android:id="#+id/button1"/></LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:gravity="bottom">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:id="#+id/txt2"
android:text="RRRRRRR"/><LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:layout_marginRight="10dp"
android:layout_marginEnd="10dp"
android:id="#+id/txt3"
android:text="JJJJJJJJJJ"/>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GO"
android:id="#+id/button2"/>
</LinearLayout>
<Button android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start"
android:id="#+id/button3"/>
</LinearLayout>
Can you help me to correct this code?
Try this code.Hope this helps you.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.7"
android:gravity="center_horizontal">
<TextView
android:id="#+id/txt1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="AAAAAAAA"
android:textSize="22sp" />
<Button
android:id="#+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BE" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="0.2"
android:gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:id="#+id/txt2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:layout_gravity="center_horizontal"
android:text="RRRRRRR"
android:textSize="22sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="horizontal">
<TextView
android:id="#+id/txt3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:text="JJJJJJJJJJ"
android:textSize="22sp" />
<Button
android:id="#+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="GO" />
</LinearLayout>
<Button
android:id="#+id/button3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="0.2"
android:layout_gravity="center_horizontal"
android:text="Start" />
</LinearLayout>
you can try this use RelativeLayout
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="#+id/txt1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center"
android:text="AAAAAAAA"
android:textSize="22sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/myl1"
android:gravity="center"
android:text="123465" />
<LinearLayout
android:id="#id/myl1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/button3"
android:orientation="horizontal">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="123465" />
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_weight="1"
android:text="Start" />
</LinearLayout>
<Button
android:id="#+id/button3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Start" />
</RelativeLayout>

how put image view to right to row of listview

how can i put image view to right of row of a list view?(square with image to right of row)
I hope that you can help me!
Thanks in advance everybody!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
this is my XML:
<LinearLayout 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:orientation="horizontal" >
<CheckBox
android:id="#+id/chk_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/chk_box"
android:textStyle="bold"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/caratteristica"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/name"
android:layout_toRightOf="#id/chk_box"
android:textStyle="italic" />
</LinearLayout>
<!-- <TextView
android:id="#+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/dist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/caratteristica"
android:layout_toRightOf="#id/chk_box"
android:textSize="12sp"
android:textStyle="italic" />
<TextView
android:id="#+id/valuta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic" />
</LinearLayout>
<EditText
android:layout_width="196dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText"
android:hint="quantità"
>
</EditText>
</LinearLayout>
</LinearLayout>
AND THIS IS PIC:
try this may be it helps you
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
>
<ImageView
android:background="#drawable/iconsmile"
android:layout_width="wrap_content"
android:layout_marginRight="10dp"
android:layout_height="wrap_content"
android:id="#+id/checkBox" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:text="I am here for you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView1" />
<TextView
android:text="I am here for you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView2" />
<TextView
android:text="I am here for you"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView3" />
</LinearLayout>
</LinearLayout>
Update Your Row to add image in right in center in
I used the image of launcher you use what u take...
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="horizontal" >
<CheckBox
android:id="#+id/chk_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true" />
<LinearLayout
android:id="#+id/linearLayout1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="#id/chk_box"
android:textStyle="bold"
android:textColor="#000000" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/caratteristica"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/name"
android:layout_toRightOf="#id/chk_box"
android:textStyle="italic" />
</LinearLayout>
<!-- <TextView
android:id="#+id/id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic"/>-->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/dist"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#id/caratteristica"
android:layout_toRightOf="#id/chk_box"
android:textSize="12sp"
android:textStyle="italic" />
<TextView
android:id="#+id/valuta"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:textSize="12sp"
android:textStyle="italic" />
</LinearLayout>
<EditText
android:layout_width="196dp"
android:layout_height="wrap_content"
android:inputType="number"
android:ems="10"
android:id="#+id/editText"
android:hint="quantità"
>
</EditText>
</LinearLayout>
<ImageView
android:id="#+id/ivImage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="5dp"
android:layout_gravity="center"
android:src="#mipmap/ic_launcher"
/>
</LinearLayout>

Change RelativeLayout to add a ListView

I have the following layout:
<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="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<EditText
android:id="#+id/etShowLog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="12"
android:textStyle="normal"
android:paddingLeft="2dip"
android:singleLine="false"
android:textColor="#999999"
android:textSize="14dip"
android:gravity="top"
android:layout_above="#+id/btnClear" />
<Button
android:id="#+id/btnClear"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_alignParentBottom="true" />
<Button
android:id="#+id/btnSave"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save Trip"
android:layout_gravity="right"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true" />
</RelativeLayout>
Which displays this:
How do I edit the layout so I can display a listview underneath:
like this,remember to keep listview height in a fixer value or use weight
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_marginBottom="200dp">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="0dp" android:layout_weight="1">
</LinearLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button"/>
<LinearLayout
android:layout_width="0px"
android:layout_height="wrap_content" android:layout_weight="1">
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="#+id/button2"/>
</LinearLayout>
</LinearLayout>
<ListView
android:layout_width="wrap_content"
android:layout_height="200dp"
android:id="#+id/listView" android:layout_gravity="center"
android:layout_marginTop="-200dp"/>
</LinearLayout>
Wrap your Buttons in a LinearLayout. Give the ListView
android:"#+id/myListView"
android:layout_alignParentBottom="true"
and the newly created LinearLayout
android:layout_above="#id/myListView
So something like this should get you close
<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="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<EditText
android:id="#+id/etShowLog"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:inputType="textMultiLine"
android:lines="12"
android:textStyle="normal"
android:paddingLeft="2dip"
android:singleLine="false"
android:textColor="#999999"
android:textSize="14dip"
android:gravity="top"
android:layout_above="#+id/btnClear" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/myListView">
<Button
android:id="#+id/btnClear"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Clear"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_gravity="left"/>
<Button
android:id="#+id/btnSave"
android:background="#drawable/otherbuttons"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Save Trip"
android:layout_gravity="right"
android:textStyle="bold"
android:textColor="#FFFFFF"
android:shadowColor="#000000"
android:shadowDx="1"
android:shadowDy="1"
android:shadowRadius="2"
android:layout_gravity="left" />
</LinearLayout>
<ListView
android:id="#+id/myListView"
...
android:layout_alignParentBottom="true"
</RelativeLayout>
I also took out the RelativeLayout properties that were in the Buttons and added android:layout_graivty="left"
android:layout_gravity="right"
Here is an alternative (but possibly old, I wrote it a few years ago) layout that includes two side-by-side listviews at the bottom of the view. There are a load of internal views, but you should be able to extract/convert what you need?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:layout_width="fill_parent"
android:id="#+id/LinearLayout" android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:background="#color/darkGrey">
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableLayout01"
android:background="#color/darkGrey">
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow01">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout01">
<TextView android:id="#+id/strap" android:layout_width="wrap_content"
android:layout_height="fill_parent" android:textSize="18sp"
android:text="Pace/Distance/Time\nCalculator" android:textColor="#color/white"
android:width="170dip" android:layout_alignParentLeft="true"
android:layout_alignParentTop="true" />
<Spinner android:layout_height="wrap_content"
android:layout_width="wrap_content" android:id="#+id/Spinner01"
android:layout_toRightOf="#+id/strap" android:prompt="#string/Presets" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow02">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout02">
<TextView android:id="#+id/topline1" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:text=" Hour" android:width="80dip" />
<TextView android:id="#+id/topline2" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline1" android:text="Mins"
android:width="80dip" />
<TextView android:id="#+id/topline3" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline2" android:text="Secs" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow03">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout03">
<EditText android:text="a" android:id="#+id/EditText01a"
android:layout_below="#+id/strap" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"
android:maxLength="2" android:inputType="number" />
<EditText android:text="b" android:id="#+id/EditText01b"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="2" android:inputType="number" />
<EditText android:text="c" android:id="#+id/EditText01c"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="6" android:inputType="numberDecimal" />
<Button android:layout_width="fill_parent" android:text="Time"
android:layout_height="wrap_content" android:layout_weight="1"
android:onClick="myClickHandler" android:id="#+id/Button01" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow04">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout04">
<TextView android:id="#+id/midline1" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text=" Enter Distance (miles)" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow05">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout05">
<EditText android:layout_height="wrap_content"
android:text="#+id/EditText02" android:layout_width="wrap_content"
android:id="#+id/EditText02" android:inputType="numberDecimal"
android:maxLength="8" android:width="120dip" />
<Button android:id="#+id/Button02" android:layout_height="wrap_content"
android:layout_width="wrap_content" android:layout_toRightOf="#+id/EditText02"
android:layout_below="#+id/midline1" android:text="Distance"
android:layout_marginLeft="103dip" android:width="100dip"
android:maxWidth="100dip" android:onClick="myClickHandler" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow06">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout06">
<TextView android:id="#+id/topline1" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:text=" Hour" android:width="80dip" />
<TextView android:id="#+id/topline2" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline1" android:text="Mins"
android:width="80dip" />
<TextView android:id="#+id/topline3" android:layout_width="wrap_content"
android:layout_below="#+id/strap" android:layout_height="wrap_content"
android:layout_toRightOf="#+id/topline2" android:text="Secs" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow07">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout07">
<EditText android:text="a2" android:id="#+id/EditText03a"
android:layout_below="#+id/strap" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_weight="1"
android:maxLength="2" android:inputType="number" />
<EditText android:text="b2" android:id="#+id/EditText03b"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="2" android:inputType="number" />
<EditText android:text="c2" android:id="#+id/EditText03c"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1" android:maxLength="6" android:inputType="numberDecimal" />
<Button android:layout_width="fill_parent" android:text="Pace"
android:layout_height="wrap_content" android:layout_weight="1"
android:onClick="myClickHandler" android:id="#+id/Button03" />
</LinearLayout>
</TableRow>
<TableRow android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/TableRow08"
android:background="#color/darkGrey">
<LinearLayout android:layout_width="wrap_content"
android:layout_height="wrap_content" android:id="#+id/LinearLayout08"
android:background="#color/darkGrey">
<ListView android:id="#+id/ListView01"
android:layout_weight="1" android:layout_height="wrap_content"
android:layout_width="fill_parent" android:background="#color/darkGrey" />
<ListView android:id="#+id/ListView02"
android:layout_weight="1" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:layout_toRightOf="#+id/ListView01"
android:background="#color/darkGrey2" />
</LinearLayout>
</TableRow>
</TableLayout>

Remove spaces between bottom layout and scrollview in android

Below is the xml code ....
Friends Help me how to avoid space between scrollview and bottomLayout
Xml file:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#color/addNewEventsCommonbg" >
<TextView
android:id="#+id/addNewEventsTitle"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_alignParentTop="true"
android:background="#drawable/dialog_title_bg"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvents"
android:textColor="#color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/addNewEventsTitleName"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_below="#+id/addNewEventsTitle"
android:background="#color/addNewEventsTitleNamebg"
android:drawableLeft="#drawable/mail_sent_icon"
android:drawablePadding="10dp"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvent"
android:textColor="#color/whiteColor"
android:textSize="16sp"
android:textStyle="normal" />
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/bottomLayout"
android:layout_below="#+id/addNewEventsTitleName" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/addNewEventsEventLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEvent"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsName"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsDateTimeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/addNewEventsDate"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<TextView
android:id="#+id/addNewEventsDate"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="#drawable/wedding_date_bg"
android:gravity="center"
android:text="#string/setDate"
android:textColor="#color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="#string/AddNewEventsTime"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<TextView
android:id="#+id/addNewEventsTime"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginLeft="5dp"
android:background="#drawable/wedding_date_bg"
android:gravity="center"
android:text="#string/setTime"
android:textColor="#color/whiteColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsAddressLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:paddingLeft="20dp"
android:text="#string/address"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsAddress"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsAddressHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textPostalAddress"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsContactLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventContact"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsContacts"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="text|textCapSentences"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsPhoneFaxLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:baselineAligned="false"
android:orientation="horizontal" >
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventsPhone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsPhone"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:inputType="phone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="right|center_vertical"
android:paddingRight="20dp"
android:text="#string/AddNewEventsFax"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsFax"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:inputType="text|phone"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsEmailLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/email"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsEmail"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEmailAddress"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<LinearLayout
android:id="#+id/addNewEventsWebsiteLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:orientation="horizontal" >
<TextView
android:layout_width="100dp"
android:layout_height="match_parent"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="#string/AddNewEventsWebsite"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
<EditText
android:id="#+id/addNewEventsWebsite"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsHeight"
android:layout_marginRight="10dp"
android:gravity="center_vertical|left"
android:inputType="textWebEditText"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
<EditText
android:id="#+id/AddNewEventsComments"
style="#style/edittext_style"
android:layout_width="match_parent"
android:layout_height="#dimen/AddNewEventsCommentsHeight"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="#dimen/AddNewEventsTopMargin"
android:gravity="left"
android:inputType="textMultiLine"
android:paddingBottom="5dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingTop="5dp"
android:singleLine="false"
android:textColor="#color/addNewEventsTextColor"
android:textSize="16sp" />
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/bottomLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal" >
<Button
android:id="#+id/addNewEventsCancelBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#drawable/cancel_btn_selector"
android:text="#string/cancel"
android:textColor="#color/whiteColor"
android:textSize="18sp" />
<Button
android:id="#+id/addNewEventsSaveBtn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="5dp"
android:layout_weight="1"
android:background="#drawable/save_btn_selector"
android:text="#string/save"
android:textColor="#color/whiteColor"
android:textSize="18sp" />
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"// Gained the whole vertical space
android:layout_weight="1" // Adding weight makes another layout fix and adjustable after these
android:layout_above="#+id/bottomLayout"
android:layout_below="#+id/addNewEventsTitleName" >
Hope these might work!

Categories

Resources