Comments (7)
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.
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.
Can you please send you layout XML file?
from sdp.
<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.
I would suggest using LinearLayout instead of RelativeLayout. In RelativeLayout elements can overlap but not in LinearLayout.
from sdp.
Its working a little better using LinearLayouts. I will just have to keep playing with the layouts. Thank you for the help.
from sdp.
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)
- How to use this library Programatically ? HOT 1
- Foldable device Support HOT 3
- when i use 1.0.6 version studio does't recognise @dimen/_Anysdp but when i use 1.0.0 it is working HOT 1
- Intuit/SDP not working - Not Scaling Vertically HOT 3
- what is new in 1.1.0 HOT 1
- Fractional "sdp" values would be very nice to have. HOT 1
- Smaller devices screen not working ? HOT 1
- Display differences have very different values HOT 2
- Can you also add the positive values ββfor 320 and 411dp widths? HOT 6
- Any thought on supporting compose? HOT 3
- Incremental build issue with sdp plugin HOT 4
- sdp is not Working in Tablet and Desktop version HOT 6
- Lag when using layout editor attributes tab HOT 1
- Plz fix size unit dp which causing Accessibility issue in Play console Pre-launch report HOT 2
- Not supporting after gradle 8.3.0 HOT 2
- ho to use negative values in sdp ? thanks HOT 1
- Different text size on landscape and portrait HOT 1
- how we use sdp for dynamic layout HOT 2
- After implementing this Library, Language is not being translated. While it used to do perfectly before. HOT 1
- Reusing same values with key HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdp.