Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – 气球聊天应用程序问题大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在做一个简单的聊天应用程序,我想要显示类似于iPhone sms app的气球.

所以我正在使用具有特定布局的ListView进行活动.
这是我的布局:

/* Activity Layout */ 
 <LinearLayout android:orientation="vertical"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent"
    >

     <ListView android:id="@+id/chat_log"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:stackFromBottom="true"
         android:layout_marginTop="50dp"
         android:transcriptMode="alwaysScroll"
         android:layout_weight="1"
         android:cachecolorHint="#00000000"
         android:clickable="false"
     />

     <LinearLayout android:orientation="horizontal"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
     >

   <EditText android:id="@+id/chat_input_text"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:layout_gravity="bottom"
         />

         <Button android:id="@+id/chat_send_button"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:text="@String/chat_send_button"
         />

     </LinearLayout>
 </LinearLayout>

其他:

/* Row Layout */
<FrameLayout xmlns:android="http://scheR_951_11845@as.android.com/apk/res/android"
 android:id="@+id/userprofile_view"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:BACkground="@drawable/chaT_Ballon_left" >

 <TextView
  android:id="@+id/chat_message"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:paddingLeft="2dp"
  android:text="haasdasdasdasdasdasdasdoo" />
</FrameLayout>

这是result.

我的问题:

>我想删除的灰线.
>文本未使用整个空间.
>不知怎的,甚至以为我添加了android:clickable =“false”气球是可点击的.

解决方法

FrameLayout是不必要的,因此使用TextView作为根元素(当然使用chaT_Ballon_left背景).将宽度设置为match_parent,以便文本占用整个空间.

BTW好气球,别忘了有hdpi版本:)

大佬总结

以上是大佬教程为你收集整理的android – 气球聊天应用程序问题全部内容,希望文章能够帮你解决android – 气球聊天应用程序问题所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。