I have this LinearLayout and in it is a Map Fragment and this all works but I cannot get the linear layout to align to the bottom of the screen for some reason. Here 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="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:baselineAligned="false"
android:weightSum="1"
android:background="#mipmap/background_colour">
<LinearLayout
android:orientation="vertical"
android:layout_width="30dp"
android:layout_height="31dp"
android:weightSum="1"
android:id="#+id/back_button"
android:background="#drawable/navigation_back"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp">
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.31">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView7" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0.30">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView6" />
</LinearLayout>
<LinearLayout
android:id="#+id/lay"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="wrap_content"
android:layout_weight="3.5">
</LinearLayout>
</LinearLayout>
The LinearLayout I am trying to align is the id: "lay" one.
I found a fix:
<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="match_parent"
android:orientation="vertical"
tools:context=".MainActivity"
android:baselineAligned="false"
android:weightSum="1"
android:background="#mipmap/background_colour">
<LinearLayout
android:orientation="vertical"
android:layout_width="30dp"
android:layout_height="31dp"
android:weightSum="1"
android:id="#+id/back_button"
android:background="#drawable/navigation_back"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp">
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="177dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView7" />
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="146dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Large Text"
android:id="#+id/textView6" />
</LinearLayout>
<LinearLayout
android:id="#+id/lay"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_alignParentBottom="true"
android:layout_height="match_parent">
</LinearLayout>
</LinearLayout>
Related
I have developing android app.
I have problem when displaying list of card in recycler-view that within in fragment_auction_products.xml.
When I navigate to FragmentAuctionProducts, I have the
this is the problem
As you can see my list starts showing after 50% space is empty... How I can solve this?
My fragment_auction_products.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="top"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/home_auction_products_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="top"
android:layout_marginTop="10dp"/>
<ProgressBar
android:id="#+id/home_auction_products_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateDrawable="#drawable/spinner_ring"
android:indeterminateOnly="true" />
</LinearLayout>
My recycler view item:
<?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="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="10dp"
android:gravity="center"
android:background="#drawable/layer_shadow"
android:orientation="horizontal">
<ImageView
android:id="#+id/home_auction_products_recycler_view_image"
android:layout_margin="4dp"
android:layout_width="125dp"
android:layout_height="150dp"
android:src="#drawable/card_example_1" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:layout_marginStart="15dp"
android:layout_marginEnd="10dp"
android:orientation="vertical"
android:paddingTop="15dp">
<TextView
android:id="#+id/home_auction_products_recycler_view_title"
style="bold"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli_bold"
android:text="Title"
android:textColor="#color/colorBlack"
android:textSize="14dp" />
<TextView
android:id="#+id/home_auction_products_recycler_view_id"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli_bold"
android:text="id"
android:textColor="#color/colorBlack"
android:textSize="0dp" />
<TextView
android:id="#+id/home_auction_products_recycler_view_current_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli_bold"
android:text="50000 тг"
android:textColor="#color/colorTextYellow"
android:textSize="16dp" />
<TextView
android:id="#+id/home_auction_products_recycler_view_start_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fontFamily="#font/muli"
android:text="start-price"
android:textColor="#color/colorBlack"
android:textSize="12dp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="8dp"
android:background="#drawable/auction_products_shape"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/home_auction_products_recycler_view_day"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="10"
android:textColor="#color/colorWhite"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="ДНЕЙ"
android:textColor="#color/colorWhite"
android:textSize="6dp" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="#drawable/auction_products_shape"
android:gravity="center"
android:orientation="vertical"
android:paddingLeft="4dp"
android:paddingTop="2dp"
android:paddingRight="4dp"
android:paddingBottom="2dp">
<TextView
android:id="#+id/home_auction_products_recycler_view_hour"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="12"
android:textColor="#color/colorWhite"
android:textSize="14dp"
android:textStyle="bold" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:fontFamily="#font/muli"
android:gravity="center"
android:text="ЧАСОВ"
android:textColor="#color/colorWhite"
android:textSize="6dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="end"
android:orientation="horizontal">
<TextView
android:id="#+id/home_auction_products_recycler_view_show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#drawable/ic_mdi_keyboard_arrow_right"
android:fontFamily="#font/muli"
android:textColor="#color/colorTextGray"
android:textSize="12dp" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
My main container where I call my fragments:
<?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="#color/colorWhite"
tools:context=".activity.MainActivity">
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="#id/bottom_nav_bar">
<FrameLayout
android:id="#+id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</ScrollView>
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/bottom_nav_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:windowBackground"
app:menu="#menu/menu" />
</RelativeLayout>
Change the FrameLayout height to match_parent.
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="#id/bottom_nav_bar">
<FrameLayout
android:id="#+id/main_fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</ScrollView>
Just use android:layout_alignParentTop.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:orientation="vertical">
<androidx.recyclerview.widget.RecyclerView
android:id="#+id/home_auction_products_recycler_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="top"
android:gravity="top"
android:layout_marginTop="10dp"/>
<ProgressBar
android:id="#+id/home_auction_products_loader"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:indeterminateDrawable="#drawable/spinner_ring"
android:indeterminateOnly="true" />
</LinearLayout>
Hope this helps.
I'm developing an Android app.
As you can see in the attached screenshot, I have an ImageView in a small size. I load it by Picasso library. Now, I'd like to enlarge it by onClick event in a new ImageView more large (id: enlarge_image, in .XML) . I looked for a solution everywhere, also throught the Android site's guide, but I don't know how to do implement it. Can anyone help me? Thanks.
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:andorid="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:id="#+id/viewA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.65"
android:orientation="horizontal">
<ImageView
android:id="#+id/img_poster_film"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:scaleType="centerCrop"
app:srcCompat="#drawable/ic_star_rate_black_18dp" />
</LinearLayout>
<LinearLayout
android:id="#+id/viewB"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.4"
android:orientation="vertical"
android:padding="8dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="5dp">
<TextView
android:id="#+id/index_title"
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/title_film" />
<TextView
android:id="#+id/original_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textColor="#color/title_color"
android:textSize="20dp" />
</LinearLayout>
<View style="#style/separator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp">
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/genres_film" />
<TextView
android:id="#+id/genres_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:paddingTop="8dp">
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="#string/date_release_film" />
<TextView
android:id="#+id/date_release_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"/>
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="35dp"
android:layout_marginStart="35dp"
android:text="#string/duration_film" />
<TextView
android:id="#+id/duration_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp" />
</LinearLayout>
<View style="#style/separator" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingTop="10dp">
<TextView
style="#style/reference_index"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="#string/overview_film" />
</LinearLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/overview_film"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:textSize="15sp"
android:layout_marginTop="5dp"
android:textStyle="italic" />
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:backgroundTint="#color/light_azure"
android:clickable="true"
android:src="#drawable/ic_star_rate_black_18dp"
app:layout_anchor="#id/viewA"
app:layout_anchorGravity="bottom|right|end" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="20dp">
<ImageView
android:id="#+id/enlarged_image"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
</android.support.design.widget.CoordinatorLayout>
I have tried to make this small form in Android, but have not been able to make the space in the third and fourth rows.
While you can implement this using a RelativeLayout, it is an ideal candidate for using ConstraintLayout which will let you specify element locations relative to each other and how they should expand/reposition themselves as the window resizes on tablets or in multiwindow mode.
Something like this :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="#+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apellidos"/>
<EditText
android:id="#+id/editText"
android:layout_toRightOf="#+id/text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hind="Apellidos"/>
<LinearLayout
android:layout_below="#+id/editText"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_weight="1"
android:layout_marginRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/text2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Ciudad"/>
<EditText
android:layout_toRightOf="#+id/text2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hind="Apellidos"/>
</RelativeLayout>
<RelativeLayout
android:layout_marginLeft="20dp"
android:layout_weight="1"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="#+id/text3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="Ciudad"/>
<EditText
android:layout_toRightOf="#+id/text3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hind="Apellidos"/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
Edit :
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/name"
android:orientation="vertical"
android:gravity="right"
android:layout_width="wrap_content"
android:layout_height="match_parent">
<TextView
android:id="#+id/text"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apellidos"/>
<TextView
android:id="#+id/text1"
android:padding="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Apelli"/>
</LinearLayout>
<LinearLayout
android:id="#+id/value"
android:orientation="vertical"
android:layout_toRightOf="#+id/name"
android:layout_width="match_parent"
android:layout_height="match_parent">
<EditText
android:id="#+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toRightOf="#+id/text"
android:hind="Apellidos" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:layout_weight="2"
android:layout_toRightOf="#+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginRight="10dp"
android:hind="Apellidos"/>
<TextView
android:layout_marginLeft="10dp"
android:layout_weight="1"
android:id="#+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="Ciudad"/>
<EditText
android:layout_weight="2"
android:layout_toRightOf="#+id/text2"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:hind="xyz"/>
</LinearLayout>
</LinearLayout>
I am trying to display admob banner in one of my android application. It have many layout in it like LinearLayout etc. I am trying to display it in bottom of screen but layout_alignParentBottom is not working in it. Please check my code and let me know what is wrong in it.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="fill_parent"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:background="#fff8f9fe"
android:gravity="center"
android:orientation="vertical">
<android.support.v7.widget.Toolbar
android:id="#+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary"
android:elevation="6dp"
android:minHeight="?attr/actionBarSize">
</android.support.v7.widget.Toolbar>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:local="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="#+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:background="#color/main_layout_background_color">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:gravity="center"
android:orientation="vertical">
<io.codetail.widget.RevealFrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:id="#+id/mainLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:background="#android:color/transparent"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:id="#+id/txtplay1"
android:layout_width="#dimen/activity_main_button_width"
android:layout_height="#dimen/activity_main_button_height"
android:layout_margin="4dp"
android:background="#drawable/play_btn"
android:gravity="center"
android:typeface="sans" />
<ImageView
android:id="#+id/favoriteTxt"
android:layout_width="#dimen/activity_main_button_width"
android:layout_height="#dimen/activity_main_button_height"
android:layout_margin="2dp"
android:background="#drawable/favorite"
android:gravity="center"
android:textColor="#color/Black" />
<ImageView
android:id="#+id/learnTxt"
android:layout_width="#dimen/activity_main_button_width"
android:layout_height="#dimen/activity_main_button_height"
android:layout_margin="2dp"
android:background="#drawable/learn"
android:gravity="center"
android:textColor="#color/Black"
android:textSize="35sp"
android:typeface="sans" />
<ImageView
android:id="#+id/txthighscore"
android:layout_width="#dimen/activity_main_button_width"
android:layout_height="#dimen/activity_main_button_height"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtfeedback1"
android:layout_margin="2dp"
android:background="#drawable/highscore_btn"
android:gravity="center"
android:padding="10dp"
android:textColor="#android:color/white"
android:typeface="sans" />
<TextView
android:id="#+id/btnshopping"
android:layout_width="05dp"
android:layout_height="05dp"
android:layout_alignParentLeft="true"
android:layout_below="#+id/txtfeedback1"
android:layout_margin="0dp"
android:background="#drawable/shopping"
android:gravity="center"
android:padding="10dp"
android:textColor="#android:color/white"
android:typeface="sans" />
<ImageView
android:id="#+id/txtcontest"
android:layout_width="#dimen/activity_main_button_width"
android:layout_height="#dimen/activity_main_button_height"
android:layout_margin="4dp"
android:background="#drawable/contest"
android:gravity="center"
android:typeface="sans" />
</LinearLayout>
</io.codetail.widget.RevealFrameLayout>
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="#+id/ad"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:gravity="center"
android:orientation="horizontal">
<com.google.android.gms.ads.AdView
android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentBottom="true"
ads:adSize="BANNER"
ads:adUnitId="#string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
</LinearLayout>
</LinearLayout>
<fragment
android:id="#+id/fragment_navigation_drawer"
android:name="com.smartedutech.ccc.fragment.NavigationFragment"
android:layout_width="#dimen/fragment_navigation_drawer_width"
android:layout_height="match_parent"
android:layout_gravity="start"
app:layout="#layout/fragment_navigation_drawer"
tools:layout="#layout/fragment_navigation_drawer" />
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Thanks
The align_XXX properties are only applicable in a RelativeLayout. LinearLayouts only lay things out linearly.
I try to make my application for different resolution and screen size. For layouts I use weights and it works perfectly but have problem with texts and icons (Vector Assets in androidstudio). Actually I use constant value for texts(e.g 20sp) and icons(e.g 20dp) but when application is open in another mobile icons are too small or too big. Is it possible to scale it by screen size in xml file?
<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="match_parent"
tools:context="com.hgyghyfghyu.apkana40.TrainerMenu"
android:orientation="vertical"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp">
//
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:background="#000000"
android:layout_marginBottom="10dp"
android:id="#+id/colorsdialogbtn">
</LinearLayout>
//
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:layout_marginBottom="10dp"
android:layout_marginTop="10dp"
android:orientation="horizontal">
//
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:id="#+id/trainermenugroupsbtn">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainermenugroupsicon"
android:tint="#FFFFFF"
android:layout_centerInParent="true"
android:src="#drawable/trainermenugroupsicon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/trainermenugroupsicon"
android:textSize="25dp"
android:textStyle="bold"
android:text=""
android:textColor="#FFFFFF"/>
</RelativeLayout>
</LinearLayout>
//
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:id="#+id/trainermenutrainersbtn">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/trainermenutrainersicon"
android:tint="#FFFFFF"
android:layout_centerInParent="true"
android:src="#drawable/trainermenutrainersicon"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="#+id/trainermenutrainersicon"
android:textSize="25dp"
android:textStyle="bold"
android:text=""
android:textColor="#FFFFFF"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
//
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:orientation="horizontal">
//
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:background="#000000"
android:id="#+id/trainermenuadbtn"
android:layout_marginRight="10dp"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="10dp">
<ImageView
android:id="#+id/trainermenuadicon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFFFFF"
android:src="#drawable/trainermenuadicon"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="#+id/trainermenuadicon"
android:layout_centerHorizontal="true"
android:textSize="15dp"
android:text=""
android:textStyle="bold"
android:textColor="#FFFFFF"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2"
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp">
//info
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:id="#+id/trainermenuinfobtn"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFFFFF"
android:src="#drawable/trainermenuinfoicon"
android:layout_centerInParent="true"/>
</RelativeLayout>
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="#000000"
android:id="#+id/trainermenusettingsbtn"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:tint="#FFFFFF"
android:layout_centerInParent="true"
android:src="#drawable/trainermenusettingicon"/>
</RelativeLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>