myc_100 2013-08-26 05:41 采纳率: 10%
浏览 2720

如何把LinearLayout 中的信息设置在布局中间?

请查看下面的代码:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".DisplayResult" >
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        >
        <ImageView
            android:id="@+id/zodiac1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/aries"
            />
        <TextView
            android:id="@+id/orTxt"
            android:text="Or"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            />
        <ImageView 
            android:id="@+id/zodiac2"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/gemini"
            />
    </LinearLayout>
    </ScrollView>

我需要把LinearLayout 中的信息设置在布局的中间。我必须使用scrollview,因为当程序都执行了的话,没有滚动很多信息不能一下子被看到。如何把信息以相同的顺序放置在中间?

  • 写回答

1条回答

  • JaveZh 2013-08-26 06:19
    关注

    你的布局是横向的,是横向居中吗?那直接在linearlayout里加
    android:gravity="center"就行了

    评论

报告相同问题?

悬赏问题

  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python