【发布时间】:2014-12-09 19:10:11
【问题描述】:
我现在正在尝试这个,但它仍然不起作用。我阅读了很多关于相对布局的教程,但我仍然做不到。请给我一个想法,我能做什么。我想要一个像图片一样的简单布局![在此处输入图片描述][1]
编辑:看起来我无法上传图片... :(
它是一个简单测验应用程序的布局,这些小部件彼此位于下方。一个进度条,一个用于问题的 TextView,4 个用于答案的按钮。 TextView 应该占据其他小部件不需要的所有位置。 Button 应始终位于末尾。
我尝试了 alignParentTop、Bottom、嵌套的 LinearLayouts,但它仍然不起作用。我能做些什么?有一个想法真的很棒吗?非常感谢!
好主意:我上传了图片:http://imgur.com/Z0YmLw2
这是实际代码。 (我编辑了大约 20 次)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:id="@+id/answerProgressBar"
style="@android:style/Widget.ProgressBar.Horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/countdownTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/answerProgressBar"
android:text="00:00:00" />
<ImageView
android:id="@+id/questionImageView"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_below="@id/countdownTextView"
android:layout_margin="5dp"
android:background="@drawable/ic_launcher"
android:scaleType="fitCenter" />
<TextView
android:id="@+id/questionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/answerProgressBar"
android:layout_margin="5dp"
android:layout_toRightOf="@id/questionImageView"
android:text="jfh rhguijfhg fhge hugutbh r rut hruteruzt dkjfh uzdt ggu zguzg zuh ftz huuh rh grhtughrtu thiohjriwetk lkj rgjrjkrjek"
android:textSize="22dp" />
<Button
android:id="@+id/answert1Button"
style="@style/answerButton"
android:text="answer 1" />
<Button
android:id="@+id/answer2Button"
style="@style/answerButton"
android:text="answer 2" />
<Button
android:id="@+id/answer3Button"
style="@style/answerButton"
android:text="answer 3" />
<Button
android:id="@+id/answer4Button"
style="@style/answerButton"
android:text="answer 4 Butto d uzrr rd drtd gzugt ffzft drtn" />
</RelativeLayout>
【问题讨论】:
-
将您的屏幕截图上传到 imgur.com 之类的地方并将其链接到您的帖子中。
标签: android android-layout android-relativelayout