[英]Layout issue for messaging app Android XML
我正在尝试在android中创建一个消息传递应用程序,并创建了一个自定义列表适配器,该适配器显示消息文本以及日期。 我同时显示了它们,现在希望它们能够以某种方式显示。 我希望能够在屏幕的一侧发送消息,而在另一侧接收消息,并且日期显示在消息文本的下方/侧面
这是我用于列表中每个项目的自定义xml,任何有关如何适当包装它们并移至屏幕两侧的想法都将不胜感激!
(注意:我尝试将LinearLayouts与权重结合使用,将RelativeLayouts与android:layout_alignParentRight和其他东西结合使用,但由于无法获得所需的确切信息,所以我想在这里问!)
(不要认为需要其他代码段,但是可以根据需要提供!)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<TextView android:id="@+id/msgTxt"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:paddingRight="2dp"
android:textStyle="bold"
android:textSize="15sp" />
<TextView android:id="@+id/msgDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</LinearLayout>
干杯
我试过使用权重的LinearLayouts
怎么了 android:layout_weight="0.4"
尝试不使用“ fill_parent”,使用“ match_parent”;
另外,替换这个
android:textSize="15sp"
对此:
android:textAppearance="?android:attr/textAppearanceMedium"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.