Android中的文本视图与另一个文本视图重叠
我在我的项目的设计部分工作 我的布局如下:Android中的文本视图与另一个文本视图重叠,android,android-layout,android-relativelayout,Android,Android Layout,Android Relativelayout,我在我的项目的设计部分工作 我的布局如下: <?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="80dp" > <RelativeLayout
<?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="80dp" >
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/textviewIdPushDate"
android:layout_toRightOf="@+id/imageviewIdPushPopup" >
<TextView
android:id="@+id/textviewIdPushShowName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:singleLine="true"
android:text="Show" />
<TextView
android:id="@+id/textviewIdPushEmailId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:singleLine="true"
android:text="Show" />
<TextView
android:id="@+id/textviewIdPushAlert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:singleLine="true"
android:text="Show" />
</RelativeLayout>
<TextView
android:id="@+id/textviewIdPushDate"
android:layout_width="150dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:gravity="right"
android:text="Show" />
<ImageView
android:id="@+id/imageviewIdPushPopup"
android:layout_width="80dp"
android:layout_height="80dp"
android:layout_alignParentLeft="true" />
</RelativeLayout>
在此布局中,包含3个文本视图的RelativeLayout
未按预期在10英寸三星平板电脑中逐个订购。在7英寸的平板电脑上同样可以工作
我已经把我的努力提高到了我的水平。有人能找出我犯的错误吗
并建议为Android设计一些教程,也许你可以使用LinearLayout而不是RelativeLayout,这样你就可以让3个文本视图排列整齐,垂直或水平,就像这样(在代码中,我把垂直方向放进去)
对于Android设计教程,我认为首先最好使用官方教程:
希望能有所帮助。在设备的不同屏幕上,它将获得不同的像素和空间。所以在大银幕上会很混乱。您可以将linearlayout与weight属性一起使用,也可以正确使用relativelayout属性。增加相对布局的高度,因为ppi超过10英寸,80 dp变小。使用7英寸和10英寸的两种布局。我能理解的是,您想在10英寸平板电脑上显示三个水平对齐的文本视图,在其他设备上显示三个垂直对齐的文本视图,是吗。
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_toLeftOf="@+id/textviewIdPushDate"
android:layout_toRightOf="@+id/imageviewIdPushPopup"
android:orientation="vertical">
<TextView
android:id="@+id/textviewIdPushShowName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:singleLine="true"
android:text="Show" />
<TextView
android:id="@+id/textviewIdPushEmailId"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:singleLine="true"
android:text="Show" />
<TextView
android:id="@+id/textviewIdPushAlert"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:singleLine="true"
android:text="Show" />
</LinearLayout>