我一直在阅读很多帖子在这里计算器有关使线性布局滚动,并已应用于所有的具体建议,使其工作,但它仍然无法在左侧显示。我是新来的Android和不知道我做错了。
<滚动型的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:工具=http://schemas.android.com/tools
机器人:ID =@ + ID / scrollView1>
<的LinearLayout
机器人:ID =@ + ID /支出
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:layout_marginLeft =10dp
机器人:layout_marginRight =10dp
机器人:重力=开始
机器人:方向=垂直
工具:费用上下文=>
<的LinearLayout
机器人:ID =@ + ID / tedsts
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =10dp
机器人:背景=@可绘制/四舍五入
机器人:可点击=真
机器人:weightSum =1.0>
<的TextView
机器人:ID =@ + ID / testffg
机器人:layout_width =1DP
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_vertical
机器人:layout_weight =30
机器人:文本=物
机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>
<的TextView
机器人:ID =@ + ID / tedssss
机器人:layout_width =1DP
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_vertical
机器人:layout_weight =65
机器人:ellipsize =结束
机器人:以下属性来=10dp
机器人:单线=真
机器人:文本=
机器人:textAppearance =:/>中的Android ATTR / textAppearanceSmall?
< ImageView的
机器人:layout_width =15dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =0.05
机器人:SRC =@可绘制/ r_arrow/>
< / LinearLayout中>
<的TextView
机器人:ID =@ + ID / tetxttx
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =右
机器人:layout_marginLeft =0dp
机器人:layout_marginRight =10dp
机器人:ellipsize =金字招牌
机器人:可聚焦=真
机器人:focusableInTouchMode =真
机器人:marqueeRepeatLimit =marquee_forever
机器人:scrollHorizontally =真
机器人:单线=真
机器人:textAppearance =机器人:ATTR / textAppearanceSmall
机器人:文字颜色=@色/ gray_dark
机器人:能见度=隐形/>
<的EditText
机器人:ID =@ + ID / teetttsss
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =10dp
机器人:背景=@可绘制/ rounded_all
机器人:EMS =10
机器人:重力=顶
机器人:提示=dgdfgfgf
机器人:inputType =textMultiLine/>
<的LinearLayout
机器人:ID =@ + ID / tesssstt
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop =10dp
机器人:背景=@可绘制/ rounded_all_clickable_selector
机器人:可点击=真
机器人:weightSum =1.0>
<的TextView
机器人:ID =@ + ID / yttrree
机器人:layout_width =1DP
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_vertical
机器人:layout_weight =20
机器人:文本=日期
机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>
<的TextView
机器人:ID =@ + ID / rrrefffe
机器人:layout_width =1DP
机器人:layout_height =WRAP_CONTENT
机器人:layout_gravity =center_vertical
机器人:layout_weight =75
机器人:ellipsize =结束
机器人:以下属性来=10dp
机器人:单线=真
机器人:文本=
机器人:textAppearance =:/>中的Android ATTR / textAppearanceSmall?
< ImageView的
机器人:layout_width =15dp
机器人:layout_height =WRAP_CONTENT
机器人:layout_weight =0.05
机器人:SRC =@可绘制/ r_arrow/>
< / LinearLayout中>
<单选按钮
机器人:ID =@ + ID / dfgrrrrr
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =2DP
机器人:layout_marginTop =5DP
机器人:文本=成本
机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>
<的EditText
机器人:ID =@ + ID / gergrerrr
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop = - 4DP
机器人:背景=@可绘制/ rounded_all_clickable
机器人:EMS =10
机器人:提示=
机器人:inputType =numberDecimal
机器人:单线=真正的>
< /的EditText>
<单选按钮
机器人:ID =@ + ID / rerreee
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =2DP
机器人:layout_marginTop =5DP
机器人:文本=时代
机器人:textAppearance =机器人:ATTR / textAppearanceMedium/>
<的EditText
机器人:ID =@ + ID / gggrrrrre
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginLeft =10dp
机器人:layout_marginRight =10dp
机器人:背景=@可绘制/ roundede
机器人:EMS =10
机器人:提示=grrrergg。
机器人:inputType =numberDecimal
机器人:单线=真
机器人:能见度=水涨船高>
< /的EditText>
<的EditText
机器人:ID =@ + ID / 65gfhhggf
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT
机器人:layout_marginTop = - 4DP
机器人:背景=@可绘制/四舍五入
机器人:EMS =10
机器人:提示=
机器人:inputType =numberDecimal>
< /的EditText>
< RelativeLayout的
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT>
<的TextView
机器人:ID =@ + ID / gfhgfhtrhrth
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentLeft =真
机器人:layout_alignParentTop =真
机器人:layout_marginLeft =50dp
机器人:layout_marginTop =15dp
机器人:能见度=水涨船高/>
<的TextView
机器人:ID =@ + ID / ghjjhhhgh
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentTop =真
机器人:layout_marginLeft =30dp
机器人:layout_marginTop =10dp
机器人:layout_toRightOf =@ + ID / expense_TV_total
机器人:文本=
机器人:textAppearance =:/>中的Android ATTR / textAppearanceLarge?
<的ImageButton
机器人:ID =@ + ID / hgjhhghjhg
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
机器人:layout_alignParentBottom =真
机器人:layout_centerHorizontal =真
机器人:layout_centerVertical =真
机器人:背景=@可绘制/ save_selector/>
< / RelativeLayout的>
< / LinearLayout中>
< /滚动型>
解决方案
使用这样的:
< XML版本=1.0编码=UTF-8&GT?;
<滚动型...>
< LinearLayout中...>
...
...
< / LinearLayout中>
< /滚动型>
和设置hieght为
安卓layout_height =WRAP_CONTENT
作为Karakuri说
I have been reading many posts here in stackoverflow about making a linear layout scroll and have applied all the specific advices to make it work but it still does not show on the left hand side. I am new to android and not sure what i am doing wrong.
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/scrollView1">
<LinearLayout
android:id="@+id/expense"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:gravity="start"
android:orientation="vertical"
tools:context=".Expense" >
<LinearLayout
android:id="@+id/tedsts"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/rounded"
android:clickable="true"
android:weightSum="1.0" >
<TextView
android:id="@+id/testffg"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".30"
android:text="Matter"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/tedssss"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".65"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:src="@drawable/r_arrow" />
</LinearLayout>
<TextView
android:id="@+id/tetxttx"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginLeft="0dp"
android:layout_marginRight="10dp"
android:ellipsize="marquee"
android:focusable="true"
android:focusableInTouchMode="true"
android:marqueeRepeatLimit="marquee_forever"
android:scrollHorizontally="true"
android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/gray_dark"
android:visibility="invisible" />
<EditText
android:id="@+id/teetttsss"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_all"
android:ems="10"
android:gravity="top"
android:hint="dgdfgfgf"
android:inputType="textMultiLine" />
<LinearLayout
android:id="@+id/tesssstt"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/rounded_all_clickable_selector"
android:clickable="true"
android:weightSum="1.0" >
<TextView
android:id="@+id/yttrree"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".20"
android:text="Date"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/rrrefffe"
android:layout_width="1dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_weight=".75"
android:ellipsize="end"
android:paddingLeft="10dp"
android:singleLine="true"
android:text=""
android:textAppearance="?android:attr/textAppearanceSmall" />
<ImageView
android:layout_width="15dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:src="@drawable/r_arrow" />
</LinearLayout>
<RadioButton
android:id="@+id/dfgrrrrr"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="5dp"
android:text="Cost"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/gergrerrr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:background="@drawable/rounded_all_clickable"
android:ems="10"
android:hint=""
android:inputType="numberDecimal"
android:singleLine="true" >
</EditText>
<RadioButton
android:id="@+id/rerreee"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="2dp"
android:layout_marginTop="5dp"
android:text="Time"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="@+id/gggrrrrre"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/roundede"
android:ems="10"
android:hint="grrrergg."
android:inputType="numberDecimal"
android:singleLine="true"
android:visibility="gone" >
</EditText>
<EditText
android:id="@+id/65gfhhggf"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="-4dp"
android:background="@drawable/rounded"
android:ems="10"
android:hint=""
android:inputType="numberDecimal" >
</EditText>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/gfhgfhtrhrth"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="50dp"
android:layout_marginTop="15dp"
android:visibility="gone" />
<TextView
android:id="@+id/ghjjhhhgh"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:layout_toRightOf="@+id/expense_TV_total"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageButton
android:id="@+id/hgjhhghjhg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/save_selector" />
</RelativeLayout>
</LinearLayout>
</ScrollView>
解决方案
use this :
<?xml version="1.0" encoding="utf-8"?>
<ScrollView ...>
<LinearLayout ...>
...
...
</LinearLayout>
</ScrollView>
and set hieght to
android:layout_height="wrap_content"
as Karakuri said
上一篇:捏缩放和平移缩放