在动态布局变化的位置按钮 [英] changed position buttons in dynamic layout

查看:122
本文介绍了在动态布局变化的位置按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这个XML.I希望包括在XML code与Java code的linearlayoutUp动态按钮,我想这个按钮出现在水平位置,以垂直挂任何想法到水平

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
的xmlns:工具=htt​​p://schemas.android.com/tool​​s
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:背景=#FFCCCCCC
机器人:方向=垂直
工具:上下文=MainActivity。><的LinearLayout
    机器人:ID =@ + ID / linearlayoutUp
    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=横向>     <滚动型
  机器人:ID =@ + ID / scrollView1
  机器人:layout_width =FILL_PARENT
  机器人:layout_height =WRAP_CONTENT
  机器人:滚动条=垂直>         < /滚动型>< / LinearLayout中>< com.example.nuevo.ControladorView
    机器人:ID =@ + ID /绘图
    机器人:layout_width =match_parent
    机器人:layout_height =0dip
    机器人:layout_marginBottom =3DP
    机器人:layout_marginLeft =5DP
    机器人:layout_marginRight =5DP
    机器人:layout_marginTop =3DP
    机器人:layout_weight =0.83/><的LinearLayout
    机器人:ID =@ + ID / linearlayoutDown
    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=垂直>< / LinearLayout中>< / LinearLayout中>


解决方案

如果您想使用滚动型,你把它周围的布局。此外,你应该使用 Horizo​​ntalScrollView 因为你的列表是水平的。

试试这个:

 < Horizo​​ntalScrollView
  机器人:ID =@ + ID / scrollView1
  机器人:layout_width =match_parent
  机器人:layout_height =WRAP_CONTENT>    <的LinearLayout
        机器人:ID =@ + ID / linearlayoutUp
        机器人:layout_width =match_parent
        机器人:layout_height =WRAP_CONTENT
        机器人:方向=横向>
    < / LinearLayout中>
< / Horizo​​ntalScrollView>

I have this XML.I want to include dynamic buttons in the linearlayoutUp of the XML code with the Java code, and I want that this buttons appear in horizontal position, any idea to hanged vertical to horizontal

<LinearLayout 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"
android:background="#FFCCCCCC"
android:orientation="vertical"
tools:context=".MainActivity" >

<LinearLayout
    android:id="@+id/linearlayoutUp"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal" >

     <ScrollView
  android:id="@+id/scrollView1"
  android:layout_width="fill_parent"
  android:layout_height="wrap_content"
  android:scrollbars="vertical" >

         </ScrollView> 

</LinearLayout>

<com.example.nuevo.ControladorView
    android:id="@+id/drawing"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:layout_marginBottom="3dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_marginTop="3dp"
    android:layout_weight="0.83" />

<LinearLayout
    android:id="@+id/linearlayoutDown"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

</LinearLayout>

</LinearLayout>

解决方案

If you want to use a ScrollView, you put it around the Layout. Also, you should use a HorizontalScrollView since your list is horizontal.

Try this:

<HorizontalScrollView
  android:id="@+id/scrollView1"
  android:layout_width="match_parent"
  android:layout_height="wrap_content" >

    <LinearLayout
        android:id="@+id/linearlayoutUp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal" >
    </LinearLayout>
</HorizontalScrollView> 

这篇关于在动态布局变化的位置按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆