i has a layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="#+id/lineradapter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
android:layout_marginTop="4dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp">
<FrameLayout
android:id="#+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="6dp">
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="#525252"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:text="00:00"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="italic" />
</FrameLayout>
<TextView
android:id="#+id/desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="6dip"
android:textColor="#acacac"
android:textSize="16dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#e7e7e7"
android:paddingTop="6dp"
android:paddingBottom="4dp" />
</LinearLayout>
</RelativeLayout>
in this layout i want to position the ListView. At the end, so that you can first see what the top, and then scroll down to see ListView. How to do it? I probyval added before /RelativeLayout>
<LinearLayout
android:id="#+id/comentadapter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp">
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="4dp"
android:layout_gravity="top|center"/>
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</LinearLayout>
But it is still located at the top.
Use this.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="#+id/lineradapter"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:layout_weight=".3"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<FrameLayout
android:id="#+id/frameLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="6dp" >
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="#525252"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:fontFamily="normal"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:text="00:00"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="italic" />
</FrameLayout>
<TextView
android:id="#+id/desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="6dip"
android:textColor="#acacac"
android:textSize="16dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#e7e7e7"
android:paddingBottom="4dp"
android:paddingTop="6dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/comentadapter"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight=".7"
android:orientation="vertical"
android:paddingLeft="10dp"
android:paddingRight="10dp" >
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:paddingTop="4dp" />
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</LinearLayout>
Best way to show the listview scrollable with the whole layout you will have to create two layout
for top.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<LinearLayout
android:id="#+id/lineradapter"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="6dp"
android:layout_marginRight="6dp"
android:layout_marginTop="4dp"
android:orientation="vertical"
android:paddingBottom="5dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp" >
<TextView
android:id="#+id/name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|left"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:textColor="#525252"
android:textSize="16sp"
android:textStyle="normal" />
<TextView
android:id="#+id/date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|right"
android:paddingBottom="2dip"
android:paddingTop="6dip"
android:text="00:00"
android:textColor="#999999"
android:textSize="14sp"
android:textStyle="italic" />
<TextView
android:id="#+id/desc"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:paddingBottom="6dip"
android:textColor="#acacac"
android:textSize="16dp" />
<View
android:layout_width="fill_parent"
android:layout_height="1dp"
android:background="#e7e7e7"
android:paddingBottom="4dp"
android:paddingTop="6dp" />
</LinearLayout>
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top|center"
android:paddingTop="4dp" />
</RelativeLayout>
and create another layout for listview list.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:paddingBottom="4dp"
android:paddingTop="4dp" >
<ListView
android:id="#+id/commentList"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
and setcontentview as list.xml and inflate top.xml and add to listview as Header like
ListView list =(ListView)findViewById(R.id.commentList);
LayoutInflater inflater = (LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View headerView =inflater.inflate(R.layout.top.xml, null);
list.addHeaderView(headerView);
Related
This issue is occuring randomly and I am an intermediate in developing native android applications. This issue ossurs 1% of user engagements within the app. Randomly I can view crash reports of this in firebase crashlytics as follows
Fatal Exception: java.lang.RuntimeException
Unable to start activity ComponentInfo{my.artic.lotcalculatorglobal/my.artic.lotcalculatorglobal.MainActivity}: android.view.InflateException: Binary XML file line #9: Binary XML file line #9: Error inflating class android.widget.RelativeLayout
This is my XML code
`<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
android:background="#drawable/alt_background"
android:fitsSystemWindows="true"
tools:context=".MainActivity">
<RelativeLayout
android:id="#+id/titleBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="25dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="20dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
<TextView
android:id="#+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/app_name"
android:textColor="#color/white"
android:textSize="20sp"
android:textStyle="bold" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/dropMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end">
<RelativeLayout
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginStart="20dp"
android:background="#drawable/menu"
android:onClick="showPopup" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:id="#+id/calculatorLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#+id/titleBar"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginBottom="80dp">
<androidx.core.widget.NestedScrollView
android:id="#+id/calScroll"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#+id/buttonlayout"
android:layout_alignParentTop="true"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="#drawable/layout_background"
android:isScrollContainer="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/fund_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_marginBottom="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="10dp"
android:text="#string/fund"
android:textColor="#color/white"
android:textStyle="bold" />
<EditText
android:id="#+id/fund"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_edit_text"
android:hint="#string/input_the_fund_value"
android:inputType="numberDecimal" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:id="#+id/crypto_info_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="10dp"
android:text="#string/choose_crypto"
android:textColor="#color/white"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:orientation="horizontal"
android:weightSum="2">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="5dp"
android:background="#drawable/bg_edit_text">
<Spinner
android:id="#+id/tab"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="10dp"
android:backgroundTint="#color/white"
android:gravity="center"
android:nestedScrollingEnabled="true"
android:spinnerMode="dropdown" />
</RelativeLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="5dp"
android:background="#drawable/bg_edit_text" />
<Spinner
android:id="#+id/currencyType"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginStart="10dp"
android:backgroundTint="#color/white"
android:gravity="center"
android:nestedScrollingEnabled="true"
android:spinnerMode="dropdown"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="10dp"
android:text="#string/service_charge"
android:textColor="#color/white"
android:textStyle="bold" />
<EditText
android:id="#+id/s_charge"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_edit_text"
android:hint="#string/input_the_service_charge_value"
android:inputType="numberDecimal" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginBottom="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="10dp" />
<EditText
android:id="#+id/lockUpDeposit"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_edit_text"
android:hint="#string/input_the_currency_value"
android:inputType="numberDecimal"
android:paddingStart="20dp" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:text="#string/range"
android:textColor="#color/white"
android:textStyle="bold" />
<EditText
android:id="#+id/range"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="#drawable/bg_edit_text"
android:hint="#string/input_the_range_value"
android:inputType="numberDecimal"
android:paddingStart="10dp"
android:textColorHint="#color/light_green"
android:visibility="gone" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_marginTop="5dp"
android:layout_toStartOf="#+id/seek_value"
android:orientation="vertical">
<SeekBar
android:id="#+id/seekBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="-15dp"
android:max="15"
android:min="5"
android:progress="15" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginEnd="15dp"
android:weightSum="2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start"
android:text="0.5" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="end"
android:text="1.5"/>
</LinearLayout>
</LinearLayout>
<TextView
android:id="#+id/seek_value"
android:layout_width="45dp"
android:layout_height="30dp"
android:layout_alignParentEnd="true"
android:layout_centerInParent="true"
android:background="#drawable/bg_edit_text"
android:gravity="center"
android:text="1.5" />
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:layout_marginBottom="5dp"
android:weightSum="2">
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:layout_marginStart="10dp"
android:text="#string/lot" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:animateLayoutChanges="true"
android:orientation="horizontal">
<TextView
android:id="#+id/lot"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/bg_white"
android:padding="10dp"
android:text="0.0" />
<RelativeLayout
android:id="#+id/copy"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="5dp"
android:background="#drawable/icon_copy"
android:onClick="onClick"
tools:ignore="SpeakableTextPresentCheck,TouchTargetSizeCheck" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/s_charge" />
<TextView
android:id="#+id/charge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:animateLayoutChanges="true"
android:background="#drawable/bg_white"
android:text="0.0" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginBottom="5dp"
android:animateLayoutChanges="true"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/profit_range"/>
<TextView
android:id="#+id/profit_range"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:background="#drawable/bg_white"
android:padding="10dp"
android:text="0.0" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:gravity="center"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/gross_profit" />
<TextView
android:id="#+id/gross_profit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text=" 0.0" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
<RelativeLayout
android:id="#+id/buttonlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:animateLayoutChanges="true"
android:orientation="vertical"
android:weightSum="2">
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/calculate"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:layout_weight="1"
android:background="#drawable/bg_button_main"
android:onClick="onClick" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/clear"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/bg_button_main"
android:onClick="onClick" />
<androidx.appcompat.widget.AppCompatButton
android:id="#+id/clearAll"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:background="#drawable/bg_button_main"
android:onClick="onClick" />
</LinearLayout>
</RelativeLayout>
</RelativeLayout>
<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"/>
</RelativeLayout>`
android.view.InflateException: Binary XML file line #44: ScrollView can host only one direct childCaused by: java.lang.IllegalStateException: ScrollView can host only one direct child at android.widget.ScrollView.addView(ScrollView.java:279)
atretrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:70)
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:aapt="http://schemas.android.com/aapt"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:layout_marginTop="#dimen/view_margin_standard"
android:layout_marginRight="#dimen/half_view_margin_standard"
android:layout_marginBottom="#dimen/half_view_margin_standard">
<LinearLayout
android:orientation="vertical"
android:id="#+id/ll_home_header_parent"
android:background="#color/card_background_color"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.core.widget.NestedScrollView
android:id="#+id/scrollView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fillViewport="true">
<TextView
android:textSize="#dimen/app_titles_text_size"
android:textStyle="bold"
android:textColor="#color/abc_decor_view_status_guard"
android:gravity="center"
android:layout_gravity="center"
android:id="#+id/tv_month_name"
android:paddingTop="#dimen/view_margin_standard"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="மே - திங்கள்"/>
<LinearLayout android:gravity="center" android:layout_gravity="center" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="#dimen/half_view_margin_standard">
<TextView android:textSize="#dimen/app_display_type_1_text_size"
android:textColor="#color/abc_decor_view_status_guard"
android:gravity="center"
android:layout_gravity="center"
android:id="#+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="08-05-2017"
android:fontFamily="#font/product_bold"/>
</LinearLayout>
<LinearLayout
android:layout_width="335dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="#dimen/half_view_margin_standard"
android:layout_marginBottom="#dimen/half_view_margin_standard"
android:orientation="horizontal">
<TextView
android:id="#+id/sf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="left"
android:text="நல்ல நேரம்"
android:textColor="#color/black"
android:textSize="#dimen/app_body_type_1_text_size" />
<TextView
android:id="#+id/tv_morning"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="left"
android:text="கா"
android:textColor="#color/black"
android:textSize="#dimen/app_body_type_1_text_size" />
<TextView
android:id="#+id/tv_morning_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="left"
android:text="10.30 - 12.00"
android:textColor="#color/black"
android:textSize="#dimen/app_body_type_1_text_size" />
<TextView
android:id="#+id/tv_evening"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:text="மா"
android:textColor="#color/black"
android:textSize="#dimen/app_body_type_1_text_size" />
<TextView
android:id="#+id/tv_evening_time"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="left"
android:text="10.30 - 12.00"
android:textColor="#color/black"
android:textSize="#dimen/app_body_type_1_text_size" />
</LinearLayout><![CDATA[ 7.00 Maalai 4.30 - 6.00"/>
]]>
<LinearLayout
android:orientation="vertical"
android:background="#color/card_background_color"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/tv_tamil_month_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="center"
android:text="சித்திரைத்"
android:textColor="#color/abc_decor_view_status_guard"
android:textSize="#dimen/app_big_sub_heads_text_size" />
<TextView
android:id="#+id/tv_viratham_home"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="center"
android:text="சித்திரைத்"
android:textColor="#color/abc_decor_view_status_guard"
android:textSize="#dimen/app_big_sub_heads_text_size" />
<TextView
android:id="#+id/tv_viratham_time_range"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_gravity="center"
android:layout_marginLeft="#dimen/half_view_margin_standard"
android:gravity="center"
android:text="சித்திரைத்"
android:textColor="#color/abc_decor_view_status_guard"
android:textSize="#dimen/app_big_sub_heads_text_size" />
<TextView
android:textSize="#dimen/app_body_type_1_text_size"
android:textColor="#color/black"
android:gravity="center"
android:layout_gravity="center"
android:id="#+id/tv_vishesham"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="#dimen/half_view_margin_standard"
android:text="காலை"/>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>
</androidx.cardview.widget.CardView>`
`
how to clear error this
you should use scrollview like this sample
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView />
<TextView />
<TextView />
</androidx.appcompat.widget.LinearLayoutCompat>
</androidx.core.widget.NestedScrollView>
Not Like this
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
</androidx.appcompat.widget.LinearLayoutCompat>
<TextView />
<TextView />
<TextView />
</androidx.core.widget.NestedScrollView>
I have some trouble.In my application I use ListView, each element is list_item.xml. I get som data from server and fills listView. The problem is that the data are displayed without spaces between them. Although the designer in android studio, everything is displayed correctly with all formattng.
My code list_item.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:weightSum="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:paddingBottom="5dp">
<TextView
android:text="123"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_employee_id"
android:textSize="40dp"
android:divider="#ffffff"
android:layout_gravity="center"
android:textAlignment="center"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.4">
<TextView
android:text="Ivan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_employee_name"
android:layout_gravity="center"
android:textSize="40dp"
android:divider="#ffffff"
android:textAlignment="center" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2"
android:layout_weight="0.2">
<TextView
android:text="Ivanoff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_employee_last_name"
android:layout_gravity="center"
android:textSize="40dp"
android:divider="#ffffff"
android:textAlignment="center" />
</LinearLayout>
</LinearLayout>
And my listViewXML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:weightSum="2"
android:layout_gravity="center"
android:background="#ffaac4ee"
>
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:weightSum="1"
android:background="#ff7b9fee"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:paddingBottom="5dp">
<TextView
android:text="№"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/id"
android:textSize="30dp"
android:divider="#ffffff"
android:layout_gravity="center"
android:textAlignment="center"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout"
android:layout_weight="0.4">
<TextView
android:text="Имя"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView5"
android:layout_gravity="center"
android:textSize="30dp"
android:divider="#ffffff"
android:textAlignment="center" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2"
android:layout_weight="0.4">
<TextView
android:text="Фамилия"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/textView9"
android:layout_gravity="center"
android:textSize="30dp"
android:divider="#ffffff"
android:textAlignment="center" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ffaac4ee"
>
<ListView
android:id="#+id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
I just change ListView attributes to
android:layout_width="fill_parent"
android:layout_height="fill_parent"
and its works!
I have edited your code by gravity:
try this:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:layout_gravity="center"
android:weightSum="1">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.2"
android:paddingBottom="5dp">
<TextView
android:text="123"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_employee_id"
android:textSize="40dp"
android:divider="#ffffff"
android:layout_gravity="left"
android:textAlignment="textStart"
/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.4">
<TextView
android:text="Ivan"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_employee_name"
android:layout_gravity="center"
android:textSize="40dp"
android:divider="#ffffff"
android:textAlignment="center" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/linearLayout2"
android:gravity="right"
android:layout_weight="0.2">
<TextView
android:text="Ivanoff"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/tv_employee_last_name"
android:layout_gravity="right"
android:textSize="40dp"
android:divider="#ffffff"
android:textAlignment="center" />
</LinearLayout>
I've already tried to align the smallprogressbar with the textview putting them into a linear layout but it doesn't work. Tryed with android:layout_gravity="left" but it crashes.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/calibration_1"
android:textColor="#33b5e5"
android:textSize="16dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvNumberWaves"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="#string/calibration_2"
android:textColor="#FFFFFF"
android:textSize="18dp" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="#+id/tvIntervalWaves"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="#string/calibration_3"
android:textColor="#FFFFFF"
android:textSize="18dp" />
<ProgressBar
android:id="#+id/progressBar2"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="#+id/bSetValues"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/calibration_5" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/calibration_6" />
</ScrollView>
</LinearLayout>
Code updated to match your answer.
I put the whole code to show what I have.
Change this line:
android:orientation="vertical"
to this:
android:orientation="horizontal"
Without seeing the rest of your source, I don't know if that will mess up other parts of your layout, so you'll probably want to wrap the TextView and ProgressBar in their own LinearLayout.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/calibration_1"
android:textColor="#33b5e5"
android:textSize="16dp"
android:textStyle="bold" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tvNumberWaves"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="#string/calibration_2"
android:textColor="#FFFFFF"
android:textSize="18dp" />
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="#+id/tvIntervalWaves"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:text="#string/calibration_3"
android:textColor="#FFFFFF"
android:textSize="18dp" />
<ProgressBar
android:id="#+id/progressBar2"
style="?android:attr/progressBarStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<Button
android:id="#+id/bSetValues"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/calibration_5" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="#string/calibration_6" />
</ScrollView>
</LinearLayout>
I would like to use the ViewPager control. I have imported the v4 support package into my build path so there are no issues there.
When I insert this into my layout XML it doesn't appear in the Graphical Layout Editor:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" android:background="#FFFFFF">
<RelativeLayout
android:id="#+id/header"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:layout_weight="0"
android:background="#000000" >
<ImageView
android:id="#+id/batteryImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:src="#drawable/battery" />
<ImageView
android:id="#+id/exit_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:src="#drawable/exit_button" />
<TextView
android:id="#+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="5dp"
android:layout_toRightOf="#+id/batteryImageView"
android:text="76%" />
</RelativeLayout>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/score"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:padding="3dp" >
<View
android:id="#+id/dynamic_background_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/topHorizontalLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<LinearLayout
android:id="#+id/prominentDisplayLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:id="#+id/scoreLabelTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Blast Factor"
android:textSize="30dp" />
<TextView
android:id="#+id/scoreTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-35dp"
android:gravity="top|center_horizontal"
android:text="100"
android:textSize="125dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/prominentVerticalLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:layout_weight="2"
android:orientation="vertical" >
<LinearLayout
android:id="#+id/averageLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<TextView
android:id="#+id/averageLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#55000000"
android:gravity="center"
android:text="Average"
android:textSize="13dp" />
<TextView
android:id="#+id/averageScore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="100"
android:textSize="50dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/lastLinearLayout"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="#+id/lastLabel"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#55000000"
android:gravity="center"
android:text="Last"
android:textSize="13dp" />
<TextView
android:id="#+id/lastScore"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="center"
android:text="100"
android:textSize="50dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="#+id/demotedDisplayLinearLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<FrameLayout
android:id="#+id/leftPanelFrame"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp" >
<LinearLayout
style="#style/MotionMetrics.ScorePanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#55000000" >
<ImageView
android:id="#+id/leftPanelImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/swingspeed" />
<TextView
android:id="#+id/leftPanelLabelTextView"
style="#style/MotionMetrics.ScoreHeader"
android:text="Swing Speed" />
<TextView
android:id="#+id/leftPanelTextView"
style="#style/MotionMetrics.ScoreValue"
android:layout_width="match_parent"
android:text="92" />
</LinearLayout>
<ImageView
android:id="#+id/leftPanelSelectionArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/select_arrow" />
</FrameLayout>
<FrameLayout
android:id="#+id/middlePanelFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#55000000" >
<LinearLayout
style="#style/MotionMetrics.ScorePanel"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<ImageView
android:id="#+id/middlePanelImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/ballspeed" />
<TextView
android:id="#+id/middlePanelLabelTextView"
style="#style/MotionMetrics.ScoreHeader"
android:text="Ball Speed" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="#+id/middlePanelTextView"
style="#style/MotionMetrics.ScoreValue"
android:text="1.3" />
</LinearLayout>
</LinearLayout>
<View
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="#drawable/score_border" />
<ImageView
android:id="#+id/middlePanelSelectionArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/select_arrow" />
</FrameLayout>
<FrameLayout
android:id="#+id/rightPanelFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginRight="2dp"
android:layout_weight="1"
android:background="#55000000" >
<ImageView
android:id="#+id/rightPanelSelectionArrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="5dp"
android:src="#drawable/select_arrow" />
<LinearLayout
style="#style/MotionMetrics.ScorePanel"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ImageView
android:id="#+id/rightPanelImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/distance" />
<TextView
android:id="#+id/rightPanelLabelTextView"
style="#style/MotionMetrics.ScoreHeader"
android:text="Distance" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="top|center_horizontal"
android:orientation="horizontal" >
<TextView
android:id="#+id/rightPanelTextView"
style="#style/MotionMetrics.ScoreValue"
android:text="7.6" />
</LinearLayout>
</LinearLayout>
<View
android:id="#+id/view1"
android:layout_width="35dp"
android:layout_height="match_parent"
android:background="#drawable/score_border" />
</FrameLayout>
</LinearLayout>
</LinearLayout>
</FrameLayout>
<android.support.v4.view.ViewPager
android:id="#+android:id/viewpager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
<LinearLayout
android:id="#+id/buttonBar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0" >
<Button
android:id="#+id/blastButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="Blast" android:layout_weight="1"/>
<Button
android:id="#+id/angleButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="Angle" android:layout_weight="1"/>
<Button
android:id="#+id/timingButton"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:text="Timing" android:layout_weight="1"/>
</LinearLayout>
<ImageView
android:id="#+id/tabBarImageView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="#drawable/tabbar"/>
</LinearLayout>
I'm not sure why, and I also don't see the UI component in my Palette.
The ViewPager needs to be populated using pagerAdapter in order for it show up on the screen.