Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/229.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 是否可以在同一行上创建布局和视图翻转器?_Android_Android Layout - Fatal编程技术网

Android 是否可以在同一行上创建布局和视图翻转器?

Android 是否可以在同一行上创建布局和视图翻转器?,android,android-layout,Android,Android Layout,是否可以通过以下方式创建屏幕 !![屏幕][2] 当我更改页面时,每个页面上都显示相同的布局 关于是的,布局是可能的: <RelativeLayout android:layout_width="fill_parent" android:layout_height="fill_parent"> <ViewFlipper android:layout_width="fill_parent" android:layout_height="fill_

是否可以通过以下方式创建屏幕

!![屏幕][2]

当我更改页面时,每个页面上都显示相同的布局


关于

是的,布局是可能的:

<RelativeLayout android:layout_width="fill_parent"
       android:layout_height="fill_parent">
   <ViewFlipper android:layout_width="fill_parent"
       android:layout_height="fill_parent">
   </ViewFlipper>
   <!-- I assumed your layout at the top-left corner is a LinearLayout, otherwise replace it with what you have --> 
   <LinearLayout android:layout_width="wrap_content" 
       android:layout_height="wrap_content"
       android:layout_alignParentTop="true" 
       android:layout_alignParentLeft="true"
       android:id="@+id/firstLayout">
   </LinearLayout>
   <TextView android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@id/firstLayout"
    android:layout_margin="5dp"/>
</RelativeLayout>

编辑:


您的问题有点含糊不清,如果您只想在布局中的
布局
元素附近添加
文本视图
,则添加
文本视图
,并将其设置为
toRightOf
属性(带有一些边距以留出一些间隙)。检查上面布局中的修改。如果您希望
文本视图
像图片中那样垂直居中(考虑到
布局
的高度),那么您可以将
布局
文本视图
包装成
线性布局
(宽度和高度设置为
包装内容
)在父级
RelativeLayout

中对齐左上角,您的问题不是很清楚,但我怀疑您所寻找的正是Kursprog提供给您的,只是您希望将左上角布局和文本视图放入包装器线性布局中,因此您的xml看起来是这样的(减去所有属性)



您需要给包装器一个fill\u parent的宽度,并将两个内部元素的布局权重设置为1,以便它们在屏幕上均匀分布

我解决了框架布局的问题。框架布局允许重叠视图

谢谢,我也试过了。但是在这种情况下:我需要将textview设置到布局的一侧(在同一行上),viewflipperI的幻灯片转换解决了FrameLayout的问题。允许重叠视图的框架布局
<RelativeLayout>  <!--Parent -->
   <ViewFlipper/>
   <LinearLayout android:orientation="horizontal"><!-- wrapper to your two top layouts 
      <LinearLayout/> <!-- whatever layout it is that you're describing in your diagram -->
      <TextView/> <!-- the text view in your diagram -->
   </LinearLayout>
</RelativeLayout>