Android values-sw360dp中的dimens文件与nexus4&;冲突;nexus5用户界面
在纵向模式下创建应用程序,在此模式下,我必须根据上边距对齐图像上的Android values-sw360dp中的dimens文件与nexus4&;冲突;nexus5用户界面,android,xml,multiscreen,Android,Xml,Multiscreen,在纵向模式下创建应用程序,在此模式下,我必须根据上边距对齐图像上的按钮。我正在使用values-sw360dp中的dimens文件,它在nexus 5中看起来很合适,但是相同的值没有对齐nexus 4中的按钮,因为这两个设备都使用dimens文件的values-sw360dp文件夹 你能为这个问题提出解决方案吗。任何一个文件夹都可以提供所有可能值的列表,这些值应该集成以支持多个屏幕 代码如下: <RelativeLayout xmlns:android="http://schemas.an
按钮。我正在使用values-sw360dp
中的dimens
文件,它在nexus 5中看起来很合适,但是相同的值没有对齐nexus 4
中的按钮,因为这两个设备都使用dimens文件的values-sw360dp
文件夹
你能为这个问题提出解决方案吗。任何一个文件夹都可以提供所有可能值的列表,这些值应该集成以支持多个屏幕
代码如下:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/windowBackground">
<ImageView
android:id="@+id/bc_logo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitStart"
android:src="@drawable/bc_imgbc_logo" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/bc_logo"
android:orientation="horizontal"
android:weightSum="1"
android:layout_alignParentTop="true"
android:layout_marginTop="@dimen/bc_img_margin_top">
<Button
android:id="@+id/login_btn"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:background="@drawable/signing_tab_btn"
android:text="SIGN IN"
android:textColor="@color/colorAccent" />
<Button
android:id="@+id/registration_btn"
style="?android:attr/buttonBarButtonStyle"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="REGISTER"
android:textColor="#FFFFFF" />
</LinearLayout>
</RelativeLayout
您需要自己添加一些值,比如背景和尺寸。。。
为不同的尺寸创建这种值结构你想让按钮接触屏幕底部吗?@Dinash检查我更新的问题nexus 4和5之间的差异有多大?nexus 4与nexus 5之间的差异为+14到15dp这里你需要使用框架布局而不是相对布局。这是一种过度布局,您可以播放一个视图而不是另一个视图。我不能使用framelayout,因为sigin和register按钮下面的布局组件都被拧紧,我面临nexus 4和5以及nexus 6和nexus 9中为按钮对齐提供的边距的尺寸值问题,因为4和5使用sw360dp文件夹,并且不知道要为哪些文件夹创建Nexus6和Nexus9?
you need to add some values by yourself like backgrounds and dimensions...
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#00FF00">
<ImageView
android:id="@+id/bc_logo"
android:layout_width="match_parent"
android:layout_height="250dp"
android:scaleType="fitXY"
android:src="@drawable/background" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="200dp"
android:orientation="horizontal"
android:layout_gravity="top"
android:weightSum="1"
>
<Button
android:id="@+id/login_btn"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="SIGN IN"
android:textColor="#00FFFF" />
<Button
android:id="@+id/registration_btn"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.5"
android:text="REGISTER"
android:textColor="#00FFFF" />
</LinearLayout>
</FrameLayout>