<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<LinearLayout
android:id="@+id/linear_share"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >

<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="15dp"
android:text="评论 "
android:textColor="@color/six1"
android:textSize="@dimen/twoTitle"
android:gravity="center" />
</LinearLayout>

<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >

<TextView
android:id="@+id/tv_supportWish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redClicked"
android:gravity="center"
android:padding="15dp"
android:text="支持Ta"
android:textColor="@color/white"
android:textSize="@dimen/twoTitle" />
</LinearLayout>

</LinearLayout>

看样子是左右平分了,其实没有,因为左右的文本不是占据一样的宽度的,左边的少两个字节

解决方案1

左边的文本改成 android:text="评论 \u3000",这样左右文本占用一样的字节,就会平分了

解决方案2

android:layout_width="0dp"

android:layout_weight="1",这样也平分了

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<LinearLayout
android:id="@+id/linear_share"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >

<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/white"
android:padding="15dp"
android:text="评论 "
android:textColor="@color/six1"
android:textSize="@dimen/twoTitle"
android:gravity="center" />
</LinearLayout>

<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center" >

<TextView
android:id="@+id/tv_supportWish"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/redClicked"
android:gravity="center"
android:padding="15dp"
android:text="支持Ta"
android:textColor="@color/white"
android:textSize="@dimen/twoTitle" />
</LinearLayout>

</LinearLayout>

更多相关文章

  1. Android: Failure [INSTALL_FAILED_DEXOPT] and Failure [INSTALL
  2. Android读取SD卡.TXT文本内容
  3. 安卓 文本 滑动 android text slide
  4. Android Studio build失败情况解决方案
  5. android 如何让文本中某个关键字高亮显示?
  6. 关于android录音权限被用户禁用的问题解决方案
  7. Android Studio安装后Fetching android sdk component informati

随机推荐

  1. android显式启动与隐式启动
  2. 在触屏设备中拖动 overflow 元素
  3. .Net 转战 Android(安卓)4.4 日常笔记(4)--
  4. android(4)(短信发送器)
  5. android——ListView功能的实现(使用simp
  6. Android模仿微信导航页效果源码
  7. Android使用ccache减少编译时间
  8. Android实现冒泡效果进度条
  9. Android 导航条效果实现(六) TabLayout+Vie
  10. 修改android设备号