Giter VIP home page Giter VIP logo

Comments (7)

elhanan-mishraky avatar elhanan-mishraky commented on September 18, 2024

I will try to give a simplified explanation. @dimen/_179sdp = 179dp on screens with a width of 300 dp. 300 dp is the baseline. On a wider screen with a width w @dimen/_179sdp = 179dp * (300 / w). So if w = 780, @dimen/_179sdp = 179dp * (300 / 780) = 465.40dp. So I think that you are using the right value, but Android studio shows you the value for sw 300 in the code preview, but on sw 780 465.40dp will be used.

from sdp.

Garguy avatar Garguy commented on September 18, 2024

Hmm, the explanation makes sense. I have a Note 5 and a S6 Edge+ and my app is not looking like I want it on those devices. But on a Note 4 and S6 Edge it looks the way I want it to. I tried to use the 179dp and on the Note 5 and S6 Edge+ its has made the layout all at the top of the screen and each item is over lapping each other.

from sdp.

elhanan-mishraky avatar elhanan-mishraky commented on September 18, 2024

Can you please send you layout XML file?

from sdp.

Garguy avatar Garguy commented on September 18, 2024

<LinearLayout
    android:id="@+id/scroll_container"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_above="@+id/space"
    android:orientation="vertical"

    >

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/_44sdp" />

    <ScrollView
        android:id="@+id/home_scrollView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:scrollbars="none">

        <LinearLayout

            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="@dimen/_64sdp"
                android:background="@drawable/bg_header"
                android:paddingLeft="@dimen/_26sdp"
                android:paddingRight="@dimen/_26sdp">

                <ImageView
                    android:id="@+id/home_cubLogo"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignBottom="@+id/landingpg_sign_in_btn"
                    android:layout_alignParentLeft="true"
                    android:layout_centerVertical="true"

                    android:background="@drawable/img_logo_home" />

                <Button
                    android:id="@+id/landingpg_sign_in_btn"
                    android:layout_width="@dimen/_96sdp"
                    android:layout_height="@dimen/_36sdp"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:background="@drawable/btn_normal"
                    android:text="@string/sign_in"
                    android:textColor="@color/white"

                    />

            </RelativeLayout>


            <View
                android:layout_width="match_parent"
                android:layout_height="@dimen/_1sdp"
                android:background="@color/grey" />

            <RelativeLayout
                android:layout_width="match_parent"
                android:layout_height="466dp">

                <ImageView
                    android:id="@+id/landing_page_default_img"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/_186sdp"
                    android:layout_centerHorizontal="true"
                    android:visibility="gone" />


                <android.support.v4.view.ViewPager
                    android:id="@+id/home_carousel"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/_186sdp"
                    android:scaleType="fitXY"
                    android:visibility="gone" />

                <com.viewpagerindicator.LinePageIndicator
                    android:id="@+id/image_slider_indicator"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/home_carousel"
                    android:paddingTop="@dimen/_2sdp"
                    android:visibility="gone"
                    app:lineWidth="@dimen/_18sdp"
                    app:selectedColor="@color/grey_no_autocomplete_bg"
                    app:strokeWidth="@dimen/_2sdp"
                    app:unselectedColor="#A6888888" />

                <View
                    android:id="@+id/place_holder"
                    android:layout_width="match_parent"
                    android:layout_height="@dimen/_50sdp"
                    android:layout_gravity="bottom"
                    android:visibility="gone" />

                <LinearLayout
                    android:id="@+id/coupons_ads_block"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_above="@+id/shoppinglis_shortcut">

                    <RelativeLayout
                        android:layout_width="match_parent"
                        android:layout_height="match_parent"
                        android:layout_weight="1">

                        <TextView
                            android:id="@+id/home_weeklyad_text"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerHorizontal="true"
                            android:padding="@dimen/_6sdp"
                            android:text="@string/weeks_ad"
                            android:textAppearance="?android:attr/textAppearanceMedium"
                            android:textColor="#808080"
                            android:textSize="@dimen/_12sdp" />


                        <RelativeLayout
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@id/home_weeklyad_text"
                            android:layout_centerHorizontal="true">

                            <ImageView
                                android:id="@+id/side_bg"
                                android:layout_width="wrap_content"
                                android:layout_height="wrap_content"
                                android:layout_alignParentLeft="true"
                                android:layout_marginTop="8dp"
                                android:src="@drawable/bg_this_weeks_ad_side"

                                />

                            <ImageView
                                android:id="@+id/weeklyad_img"
                                android:layout_width="140dp"
                                android:layout_height="100dp"
                                android:layout_marginLeft="8dp"
                                android:background="@drawable/img_ad_default"
                                android:contentDescription="@string/weeklyad_desc"
                                android:src="@drawable/img_ad_default" />
                        </RelativeLayout>
                    </RelativeLayout>

                    <RelativeLayout
                        android:layout_width="fill_parent"
                        android:layout_height="fill_parent"
                        android:layout_weight="1">

                        <TextView
                            android:id="@+id/feat_coupons_text"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerHorizontal="true"
                            android:padding="6dp"
                            android:text="@string/lndpage_feat_coupons"
                            android:textColor="#808080"
                            android:textSize="12sp" />

                        <ImageView
                            android:id="@+id/feat_coupons"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@+id/feat_coupons_text"
                            android:layout_centerInParent="true"
                            android:layout_marginTop="16dp"
                            android:contentDescription="@string/coupon_img_desc"
                            android:src="@drawable/img_coupons_default" />

                        <include
                            android:id="@+id/coupons_grid"
                            layout="@layout/coupons_grid"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_below="@id/feat_coupons_text"
                            android:visibility="gone" />
                    </RelativeLayout>
                </LinearLayout>

                <include
                    android:id="@id/shoppinglis_shortcut"
                    layout="@layout/shopping_list_widget" />
            </RelativeLayout>


        </LinearLayout>
    </ScrollView>


</LinearLayout>


<FrameLayout
    android:id="@+id/home_alpha_background"

    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentBottom="true"
    android:background="#CC000000"
    android:visibility="gone" />

<FrameLayout
    android:id="@+id/sliding_tab"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true" />

<include
    android:id="@+id/include_nav_actionbar"
    layout="@layout/list_header_navigation"

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top" />

<RelativeLayout
    android:id="@+id/frag_tab"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:background="@drawable/img_arch">

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginLeft="36dp">


        <com.supervalu.roboto.widgets.RobotoTextView
            android:id="@+id/landingpage_mystore_txt"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:paddingLeft="10dp"
            android:text="@string/myStoreText"
            android:textColor="@color/white"
            app:typeface="roboto_light" />

        <ImageView
            android:id="@+id/landingpage_home_icn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_toLeftOf="@id/landingpage_mystore_txt"
            android:src="@drawable/icn_home_my_store" />
    </RelativeLayout>


</RelativeLayout>

<include
    android:id="@+id/landingpage_screenOverlay"
    layout="@layout/navigation_item_overlay"

    />

<View
    android:id="@+id/space"
    android:layout_width="match_parent"
    android:layout_height="50dp"
    android:layout_alignParentBottom="true"
    android:visibility="invisible" />

Where it says 466dp in the Relative layout I have tried to change that to 179dp from the library and it makes it 179dp not 465.40dp

from sdp.

elhanan-mishraky avatar elhanan-mishraky commented on September 18, 2024

I would suggest using LinearLayout instead of RelativeLayout. In RelativeLayout elements can overlap but not in LinearLayout.

from sdp.

Garguy avatar Garguy commented on September 18, 2024

Its working a little better using LinearLayouts. I will just have to keep playing with the layouts. Thank you for the help.

from sdp.

rajohns08 avatar rajohns08 commented on September 18, 2024

179dp * (300 / 780) = 465.40dp

@elhanan-mishraky, Did you mean 179dp * (780 / 300) = 465.40dp? I can only get 465.40 if I use w/300 instead of 300/w like you specified.

from sdp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.