Android 替代列表项样式
我正在尝试创建一个类似于 谁能帮我创造它 我试过的Android 替代列表项样式,android,android-layout,Android,Android Layout,我正在尝试创建一个类似于 谁能帮我创造它 我试过的 对列表项进行单独查看,即列表项\u偶数和“列表项\u奇数” 为了简洁起见,我只展示其中一个,下面是list\u item\u甚至 <TextView android:id="@+id/displaysms_lastmsgtime" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_
列表项\u偶数
和“列表项\u奇数”list\u item\u甚至
<TextView
android:id="@+id/displaysms_lastmsgtime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/displaysms_contactname"
android:layout_below="@+id/displaysms_contactname"
android:gravity="right"
android:text="88:88"
android:textColor="#10bcc9"
android:textSize="12sp"
android:textStyle="bold" />
<TextView
android:id="@+id/displaysms_msgtext"
android:layout_width="260dp"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/imageButton1"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/imageButton1"
android:background="#fff"
android:shadowColor="@color/textShadow"
android:shadowDx="1"
android:shadowDy="1"
android:text="hi"
android:textColor="@color/textColor"
android:textSize="16sp" />
<ImageButton
android:id="@+id/imageButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/displaysms_lastmsgtime"
android:src="@android:drawable/btn_star" />
<TextView
android:id="@+id/displaysms_contactname"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginTop="45dp"
android:layout_toRightOf="@+id/displaysms_msgtext"
android:text="john"
android:textColor="#fff"
android:textSize="15sp"
android:textStyle="bold"
android:typeface="sans" />
黄色
图标并在其中放置图像?
plaese帮助,关于我认为您最好以编程方式定义布局,如果奇数使用一个布局,如果偶数使用另一个布局,则检查行号 如果(行%2==0)使用一个布局 否则就换一个 是否可以在不使用图像和位置的情况下创建黄色图标 里面有图像吗
也许吧,但为什么要对自己施加不必要的约束呢?如果你担心拉伸尖头部分,你可以在黄色背景上使用一个9patch绘图。你可以了解关于9patch的所有信息。我这样做没有问题,我已经在列表适配器中处理好了,问题是我无法复制第一张图片中所示的布局,我已经附上了我的布局输出(图:2),它与第一张完全不同。你的标题有误导性。我建议您编辑它以反映实际问题。您的问题似乎并不在于实现交替列表项样式。请查看以下内容: