Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Android
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Java Persistence with Spring Data and Hibernate
this week in the
Spring
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Tim Cooke
Paul Clapham
Liutauras Vilda
Sheriffs:
Junilu Lacar
Rob Spoor
Jeanne Boyarsky
Saloon Keepers:
Stephan van Hulst
Carey Brown
Tim Holloway
Piet Souris
Bartenders:
Forum:
Android
how to handle different screen sizes
shawn peter
Ranch Hand
Posts: 1325
1
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
here is my xml file which contain two buttons.I need these two button to take whole space vertically when the app is running.This is working fine in my phone.But if i use large screen phones this is not working fine.how to reslve this ?
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" android:background="@drawable/google_android" tools:context=".Commom" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="top|center_horizontal" > <Button android:id="@+id/D" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="50" android:text="@string/Dialog" > </Button> <Button android:id="@+id/M" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="50" android:text="@string/Mobitel" > </Button> </LinearLayout> </RelativeLayout>
Steve Luke
Bartender
Posts: 4179
22
I like...
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The buttons' height are set to wrap_content. What does that do? Why is that wrong? What should t be instead?
Steve
shawn peter
Ranch Hand
Posts: 1325
1
posted 9 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
tnx steve.I change it to match_parent.anyway buttons doesn't fill full space horizontally also.please advice.
ab singh
Greenhorn
Posts: 20
posted 7 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Use weight and height as match parent. Hope it was helpful,
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="top|center_horizontal" android:orientation="horizontal" > <Button android:id="@+id/D" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="dialog" > </Button> <Button android:id="@+id/M" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="Mobitel" > </Button> </LinearLayout> </RelativeLayout>
So I left, I came home, and I ate some pie. And then I read this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Layout question.
Issue Dynamically Changing TextView
how to add a scrollbar to a view
how to put button inside a SurfaceView and on the bootom of the screen?
Layouts, bottom position
More...