我为自定义适配器制作了single_row.xml,它在几个设备上完美运行,但在HighEnd设备的情况下,TextVIew略微偏离中心。为什么?请帮助..
Image Link to understand the question Clearly
single_row.xml
<?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="match_parent"
>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageViewSingleRow"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:src="@drawable/one"
android:paddingTop="12dp"
android:paddingBottom="12dp"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:adjustViewBounds="true"
/>
<TextView
android:paddingTop="10dp"
android:paddingBottom="6dp"
android:paddingLeft="5dp"
android:paddingRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Title text here"
android:id="@+id/textViewTitle"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignBottom="@+id/imageViewSingleRow"
android:layout_toRightOf="@+id/imageViewSingleRow"
android:layout_toEndOf="@+id/imageViewSingleRow"
android:textSize="18dp"
android:gravity="center_vertical"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textSize="20sp"
android:textStyle="normal"
android:id="@+id/textViewNumbering"
android:layout_alignLeft="@+id/imageViewSingleRow"
android:layout_alignTop="@+id/imageViewSingleRow"
android:layout_alignRight="@+id/imageViewSingleRow"
android:layout_alignBottom="@+id/imageViewSingleRow"
android:gravity="center"
/>
<TextView
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="description"
android:id="@+id/textViewDescription"
android:layout_below="@+id/textViewTitle"
android:layout_centerHorizontal="true" />
<TextView
android:visibility="gone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="imageLink"
android:id="@+id/textViewImageLink"
android:layout_below="@+id/textViewDescription"
android:layout_alignRight="@+id/textViewDescription"
android:layout_alignEnd="@+id/textViewDescription"
/>
</RelativeLayout>
答案 0 :(得分:0)
最后也为高端设备做了..
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:text="1"
android:padding="26dp"
android:textStyle="bold"
android:id="@+id/textViewNumbering"
android:layout_alignTop="@+id/imageViewSingleRow"
android:layout_alignBottom="@+id/imageViewSingleRow"
android:gravity="center"
/>