Android的要使可视屏幕滚动的一部分 [英] Android To make part of the visible screen scrollable

查看:245
本文介绍了Android的要使可视屏幕滚动的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索网,找到我的如下问题的答案。但是,没有找到答案。我自己试了几种方法,但我还是在Android的新手。我净相关滚动发现是官方文档和滚动在 http://developer.android.com 的例子,Senthilkumar先生的<一个href=\"http://stackoverflow.com/questions/5142263/how-to-scroll-the-screen-i-mean-how-to-move-the-screen\">How滚动屏幕,Kakka47的<一个href=\"http://stackoverflow.com/questions/5079631/scrollview-only-on-part-of-the-screen-in-android\">ScrollView只有屏幕,darrinps 滚动视图与部分只有部分屏幕滚动等。

这是因为从以上职称非常明确常见的要求。我有以下的屏幕布局如图所示。

从上列标题画面稳定。该表记录,下面列标题需要滚动。我有AbsoluteLayout(我知道这是pcated德$ P $但这是唯一一个我可以通过特定的需要使用),里面滚动型和滚动型里面一个TableLayout。

用户点击添加按钮添加收到的订单。在一排一个顺序。由于行增加,他们超越可见区域。因此,我希望它滚动,用户可以访问它。但是,这部分不是滚动。我给我的code上市。请告诉我该怎么做。

code:

 包com.BookOrders;    进口的java.util.Calendar;    进口android.app.Activity;
    进口android.app.DatePickerDialog;
    进口android.app.Dialog;
    进口android.content.Context;
    进口android.os.Bundle;
    进口android.view.View;
    进口android.widget.AbsoluteLayout;
    进口android.widget.Button;
    进口android.widget.CheckBox;
    进口android.widget.DatePicker;
    进口android.widget.EditText;
    进口android.widget.ScrollView;
    进口android.widget.Spinner;
    进口android.widget.TableLayout;
    进口android.widget.TableRow;
    进口android.widget.TextView;    //进口android.widget.TableRow.LayoutParams;    @燮pressWarnings(德precation)
    公共类BookOrders扩展活动实现ScrollViewListener {
    / **当第一次创建活动调用。 * /
私人TextView的BookingDateDisplay;
私人按钮CHANGEDATE,AddRec,DeleteRec,白水回收;
私人复选框SelectedAll,SelectedRec;
私人ObservableScrollView CustomScroller = NULL;
私人ObservableScrollView CustomScrolled = NULL;
私人诠释ChangedYear;
私人诠释ChangedMonth;
私人诠释ChangedDay;
公共语境CurrentContext,UsedContext;
静态最终诠释DATE_DIALOG_ID = 0;
INT IdGenerator = 100000;
INT Number_of_Records = 0;
@覆盖
公共无效的onCreate(捆绑savedInstanceState){
    super.onCreate(savedInstanceState);    的setContentView(R.layout.main);
    @燮pressWarnings(德precation)
    最后AbsoluteLayout主要=(AbsoluteLayout)findViewById(R.id.widget0);
    CurrentContext = main.getContext();
    //最后滚动型ScrollControl =(滚动型)findViewById(R.id.scroller);
    //最后AbsoluteLayout LayerControl =(AbsoluteLayout)findViewById(R.id.FinalLayer);
   // UsedContext = LayerControl.getContext();
 //获取我们的视图元素
    CustomScroller =(ObservableScrollView)findViewById(R.id.scrollContainer);    BookingDateDisplay =(的TextView)findViewById(R.id.BookedDate);
    CHANGEDATE =(按钮)findViewById(R.id.pickDate);
    AddRec =(按钮)findViewById(R.id.AddRecord);
    DeleteRec =(按钮)findViewById(R.id.DeleteRecord);
    白水回收=(按钮)findViewById(R.id.SaveRecord);
    SelectedAll =(复选框)findViewById(R.id.SelectAll);    //点​​击监听器添加到按钮
    ChangeDate.setOnClickListener(新View.OnClickListener(){
        公共无效的onClick(视图v){
            的ShowDialog(DATE_DIALOG_ID);
        }
    });
    AddRec.setOnClickListener(新View.OnClickListener(){
        公共无效的onClick(查看AddRecView){
            IdGenerator = IdGenerator + 10;
            UsedContext = AddRecView.getContext();
            TR的TableRow =新的TableRow(UsedContext);
            为(int控制= 0;对照6;;控制++){                如果(对照== 0){
                    复选框RecordCheck =新的复选框(UsedContext);
                    RecordCheck.setId(IdGenerator +控制);
                    RecordCheck.setTag(CheckBoxTag);
                    RecordCheck.setHeight(20);
                    RecordCheck.setWidth(25);
                    Tr.addView(RecordCheck);
                }
                如果((0℃;对照)及及(对照小于5)){
                    微调记录=新的微调(UsedContext);
                    Record.setId(IdGenerator +控制);
                    //Record.setMinimumHeight(20);
                    //Record.setMinimumWidth(90);
                    Tr.addView(录音);
                }
                如果(控制== 5){
                    的EditText OrderQuantity =新的EditText(UsedContext);
                    OrderQuantity.setId(IdGenerator +控制);
                    //OrderQuantity.setHeight(20);
                    //OrderQuantity.setWidth(90);
                    Tr.addView(OrderQuantity);
                }            }
            TableLayout订单=(TableLayout)findViewById(R.id.OrderData);
            Orders.addView(TR);
            //滚动到最后前行 - 为什么?
            最后滚动型ScrollAttempt =(滚动型)findViewById(R.id.scrollContainer);
            ScrollAttempt.post(新的Runnable(){
                公共无效的run(){
                    ScrollAttempt.fullScroll(View.FOCUS_DOWN);
                }            });
            Number_of_Records = Number_of_Records + 1;
          }    });
    //更新日期TextView的
    私人无效updateDisplay(){
    BookingDateDisplay.setText(
            新的StringBuilder()
            .append(ChangedDay).append( - )
            基于这样 - ()//月为0 1 .append(ChangedMonth + 1).append
            .append(ChangedYear).append());}
//调用当用户在对话框中的设置中可以追溯到收到    私人DatePickerDialog.OnDateSetListener DateSetListener =
        新DatePickerDialog.OnDateSetListener(){
            公共无效onDateSet(查看的DatePicker,年整型,诠释monthOfYear,诠释请将dayOfMonth){
            ChangedYear =年;
            ChangedMonth = monthOfYear;
            ChangedDay =请将dayOfMonth;
            updateDisplay();
            }
        };
        @覆盖
        保护对话框onCreateDialog(INT ID){
            开关(ID){
                案例DATE_DIALOG_ID:
                    返回新DatePickerDialog(这一点,Da​​teSetListener,ChangedYear,ChangedMonth,ChangedDay);
                    }
            返回null;
            }
        公共无效onScrollChanged(ObservableScrollView滚动视图,诠释的x,INT Y,INT oldx,诠释oldy){
            如果(滚动视图== CustomScroller){
                CustomScrolled.scrollTo(X,Y);
            }否则如果(滚动视图== CustomScrolled){
                CustomScroller.scrollTo(X,Y);
            }
        } }

我的的main.xml

 &LT;?XML版本=1.0编码=UTF-8&GT?;
&LT; AbsoluteLayout的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:ID =@ + ID / widget0
    机器人:layout_width =WRAP_CONTENT
    机器人:layout_height =WRAP_CONTENT&GT;    !&LT; - &LT; ImageButton的机器人:文本=日期机器人:layout_height =20像素的android:layout_width =32PX机器人:ID =@ + ID / BDate机器人:layout_x =274dip机器人:layout_y =51dip&GT;&LT; / ImageButton的&GT; - &GT;    &LT;的TextView
        机器人:ID =@ + ID /标题
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =81dip
        机器人:layout_y =10dip
        机器人:背景=#0ff0ff
        机器人:比重=中心
        机器人:文字=订单预订
        机器人:文字颜色=#330000
        机器人:TEXTSIZE =20SP
        机器人:文字样式=大胆
        机器人:字体=衬&GT;
    &LT; / TextView的&GT;    &LT;的TextView
        机器人:ID =@ + ID / BDate_text
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =277dip
        机器人:layout_y =52dip
        机器人:重力=右
        机器人:文字=预订于:
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;的TextView
        机器人:ID =@ + ID / BookedDate
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =350dip
        机器人:layout_y =52dip
        机器人:文字=
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;按钮
        机器人:ID =@ + ID / pickDate
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =400dip
        机器人:layout_y =15dip
        机器人:文本=更改日期
        机器人:TEXTSIZE =10SP&GT;
    &LT; /按钮&GT;    &LT;查看
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =36dp
        机器人:layout_y =68dp
        机器人:背景=@绘制/梯度&GT;
    &LT; /视图&gt;    &LT;按钮
        机器人:ID =@ + ID /的AddRecord
        机器人:layout_width =120dp
        机器人:layout_height =34dp
        机器人:layout_x =10dip
        机器人:layout_y =71dip
        机器人:文字=添加
        机器人:TEXTSIZE =10SP&GT;
    &LT; /按钮&GT;    &LT;按钮
        机器人:ID =@ + ID / DeleteRecord
        机器人:layout_width =120dp
        机器人:layout_height =34dp
        机器人:layout_x =140dp
        机器人:layout_y =71dp
        机器人:文字=删除
        机器人:TEXTSIZE =10SP&GT;
    &LT; /按钮&GT;    &LT;按钮
        机器人:ID =@ + ID / ClearRecord
        机器人:layout_width =120dp
        机器人:layout_height =34dp
        机器人:layout_x =270dp
        机器人:layout_y =71dp
        机器人:文字=清除
        机器人:TEXTSIZE =10SP&GT;
    &LT; /按钮&GT;    &LT;按钮
        机器人:ID =@ + ID / SaveRecord
        机器人:layout_width =120dp
        机器人:layout_height =34dp
        机器人:layout_x =400dp
        机器人:layout_y =71dp
        机器人:文本=保存
        机器人:TEXTSIZE =10SP&GT;
    &LT; /按钮&GT;    &LT;查看
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =1DP
        机器人:layout_y =110dp
        机器人:背景=@绘制/梯度&GT;
    &LT; /视图&gt;    &LT;复选框
        机器人:ID =@ + ID /全选
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =20dp
        机器人:layout_x =10dip
        机器人:layout_y =115dip
        机器人:文字=全选
        机器人:TEXTSIZE =10SP&GT;
    &LT; /复选框&GT;    &LT;的TextView
        机器人:ID =@ + ID /公司
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =95dip
        机器人:layout_y =115dip
        机器人:背景=#666666
        机器人:文字=公司
        机器人:文字颜色=#000000
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;的TextView
        机器人:ID =@ + ID /产品
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =200dip
        机器人:layout_y =115dip
        机器人:背景=#666666
        机器人:文字=产品
        机器人:文字颜色=#000000
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;的TextView
        机器人:ID =@ + ID / code
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =300dip
        机器人:layout_y =115dip
        机器人:背景=#666666
        机器人:文字=code
        机器人:文字颜色=#000000
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;的TextView
        机器人:ID =@ + ID /模型
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =380dp
        机器人:layout_y =115dp
        机器人:背景=#666666
        机器人:文字=模式
        机器人:文字颜色=#000000
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;的TextView
        机器人:ID =@ + ID /数量
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_x =470dp
        机器人:layout_y =115dp
        机器人:背景=#666666
        机器人:文字=数量
        机器人:文字颜色=#000000
        机器人:TEXTSIZE =12SP&GT;
    &LT; / TextView的&GT;    &LT;查看
        机器人:ID =@ + ID /厂景
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =1DP
        机器人:layout_x =0dip
        机器人:layout_y =134dip
        机器人:背景=@绘制/梯度&GT;
    &LT; /视图&gt;    &LT; com.BookOrders.ObservableScrollView
        机器人:ID =@ + ID / scrollContainer
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT
        机器人:layout_weight =1
        机器人:layout_x =1DP
        机器人:layout_y =140dp
        机器人:可点击=真
        机器人:fadeScrollbars =假
        机器人:fillViewport =真正的&GT;        &LT; TableLayout
            机器人:ID =@ + ID / OrderData
            机器人:layout_width =WRAP_CONTENT
            机器人:layout_height =WRAP_CONTENT
            机器人:stretchColumns =0,1,2,3,4/&GT;
    &LT; /com.BookOrders.ObservableScrollView>&LT; / AbsoluteLayout&GT;


解决方案

我制定了解决方案这一点。对于那些想知道谁可以先通过下面的链接
http://blog.stylingandroid.com/archives/447

我用这个逻辑。不过,我创建行动态用户点击添加按钮。唯一的问题是,如果你使用你微调将无法设置其高度为零。

尼廷

I searched net to find the answer for my following problem. But no answer found. I myself tried several ways, but I am still a novice at Android. What I found on net related to scrolling is official documentation and examples of scrolling on http://developer.android.com, Mr. Senthilkumar's How to scroll the screen, Kakka47's ScrollView only part of the screen, darrinps A scroll view with only part of the screen scrolling, etc.

This is very common requirement as is clear from above titles. I have following screen layout as shown in figure.

The screen from top to column titles is stable. The table records, below column titles needs to scroll. I have AbsoluteLayout (I know it is deprecated but that is the only one I can use for by specific need), inside it a scrollview and inside scrollview a TableLayout.

User clicks "Add" button to add the orders received. One order in one row. As rows increase, they go beyond visible area. Therefore, I want it to scroll so user can access it. But this part is not scrolling. I have given the listing of my code. Please tell me what to do.

Code:

    package com.BookOrders;

    import java.util.Calendar;

    import android.app.Activity;
    import android.app.DatePickerDialog;
    import android.app.Dialog;
    import android.content.Context;
    import android.os.Bundle;
    import android.view.View;
    import android.widget.AbsoluteLayout;
    import android.widget.Button;
    import android.widget.CheckBox;
    import android.widget.DatePicker;
    import android.widget.EditText;
    import android.widget.ScrollView;
    import android.widget.Spinner;
    import android.widget.TableLayout;
    import android.widget.TableRow;
    import android.widget.TextView;

    //import android.widget.TableRow.LayoutParams;

    @SuppressWarnings("deprecation")
    public class BookOrders extends Activity implements ScrollViewListener{
    /** Called when the activity is first created. */
private TextView BookingDateDisplay;    
private Button ChangeDate, AddRec, DeleteRec, SaveAll;
private CheckBox SelectedAll, SelectedRec;
private ObservableScrollView CustomScroller = null;
private ObservableScrollView CustomScrolled = null;
private int ChangedYear;    
private int ChangedMonth;    
private int ChangedDay;
public Context CurrentContext, UsedContext;
static final int DATE_DIALOG_ID = 0;
int  IdGenerator = 100000;
int Number_of_Records = 0; 
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
    @SuppressWarnings("deprecation")
    final AbsoluteLayout main = (AbsoluteLayout)findViewById(R.id.widget0);
    CurrentContext = main.getContext();
    //final ScrollView ScrollControl = (ScrollView)findViewById(R.id.scroller);
    //final AbsoluteLayout LayerControl = (AbsoluteLayout)findViewById(R.id.FinalLayer);
   // UsedContext = LayerControl.getContext();
 // capture our View elements  
    CustomScroller = (ObservableScrollView) findViewById(R.id.scrollContainer);

    BookingDateDisplay = (TextView) findViewById(R.id.BookedDate);        
    ChangeDate = (Button) findViewById(R.id.pickDate);        
    AddRec = (Button) findViewById(R.id.AddRecord);
    DeleteRec = (Button) findViewById(R.id.DeleteRecord);
    SaveAll = (Button) findViewById(R.id.SaveRecord);
    SelectedAll = (CheckBox) findViewById(R.id.SelectAll);

    // add a click listener to the button        
    ChangeDate.setOnClickListener(new View.OnClickListener() {            
        public void onClick(View v) {                
            showDialog(DATE_DIALOG_ID);            
        }
    }); 
    AddRec.setOnClickListener(new View.OnClickListener() { 
        public void onClick(View AddRecView) { 
            IdGenerator = IdGenerator+10;
            UsedContext = AddRecView.getContext();
            TableRow Tr = new TableRow(UsedContext);
            for (int controls=0; controls<6; controls++) {

                if (controls==0){
                    CheckBox RecordCheck = new CheckBox(UsedContext);
                    RecordCheck.setId(IdGenerator+controls);
                    RecordCheck.setTag("CheckBoxTag");
                    RecordCheck.setHeight(20);
                    RecordCheck.setWidth(25);
                    Tr.addView(RecordCheck);
                }
                if ((0 < controls ) && (controls<5)){
                    Spinner Record   = new Spinner(UsedContext);
                    Record.setId(IdGenerator+controls);
                    //Record.setMinimumHeight(20);
                    //Record.setMinimumWidth(90);
                    Tr.addView(Record);
                }
                if (controls==5){
                    EditText OrderQuantity = new EditText(UsedContext);
                    OrderQuantity.setId(IdGenerator+controls);
                    //OrderQuantity.setHeight(20);
                    //OrderQuantity.setWidth(90);
                    Tr.addView(OrderQuantity);
                }

            }
            TableLayout Orders = (TableLayout)findViewById(R.id.OrderData);
            Orders.addView(Tr);
            // Scrolls to line before last - why?
            final ScrollView ScrollAttempt = (ScrollView) findViewById(R.id.scrollContainer);
            ScrollAttempt.post(new Runnable() {
                public void run() {
                    ScrollAttempt.fullScroll(View.FOCUS_DOWN);
                }

            });
            Number_of_Records = Number_of_Records + 1;
          }

    });
    // updates the date in the TextView    
    private void updateDisplay() {        
    BookingDateDisplay.setText(            
            new StringBuilder()                    
            .append(ChangedDay).append("-") 
            .append(ChangedMonth + 1).append("-")       // Month is 0 based so add 1  
            .append(ChangedYear).append(" "));    

}
// the call back received when the user "sets" the date in the dialog    

    private DatePickerDialog.OnDateSetListener DateSetListener =            
        new DatePickerDialog.OnDateSetListener(){
            public void onDateSet(DatePicker view, int year,  int monthOfYear, int dayOfMonth) {                    
            ChangedYear = year;                    
            ChangedMonth = monthOfYear;                    
            ChangedDay = dayOfMonth;                    
            updateDisplay();                
            }            
        };
        @Override
        protected Dialog onCreateDialog(int id) {    
            switch (id) {    
                case DATE_DIALOG_ID:        
                    return new DatePickerDialog(this, DateSetListener, ChangedYear, ChangedMonth, ChangedDay);    
                    }    
            return null;
            }
        public void onScrollChanged(ObservableScrollView scrollView, int x, int y, int oldx, int oldy) {
            if(scrollView == CustomScroller) {
                CustomScrolled.scrollTo(x, y);
            } else if(scrollView == CustomScrolled) {
                CustomScroller.scrollTo(x, y);
            }
        }

 }

My main.xml:

    <?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/widget0"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <!-- <ImageButton android:text="Date" android:layout_height="20px" android:layout_width="32px" android:id="@+id/BDate" android:layout_x="274dip" android:layout_y="51dip"></ImageButton> -->

    <TextView
        android:id="@+id/Title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="81dip"
        android:layout_y="10dip"
        android:background="#0ff0ff"
        android:gravity="center"
        android:text="Order Booking"
        android:textColor="#330000"
        android:textSize="20sp"
        android:textStyle="bold"
        android:typeface="serif" >
    </TextView>

    <TextView
        android:id="@+id/BDate_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="277dip"
        android:layout_y="52dip"
        android:gravity="right"
        android:text="Booked on:"
        android:textSize="12sp" >
    </TextView>

    <TextView
        android:id="@+id/BookedDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="350dip"
        android:layout_y="52dip"
        android:text=""
        android:textSize="12sp" >
    </TextView>

    <Button
        android:id="@+id/pickDate"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="400dip"
        android:layout_y="15dip"
        android:text="Change Date"
        android:textSize="10sp" >
    </Button>

    <View
        android:layout_width="wrap_content"
        android:layout_height="36dp"
        android:layout_y="68dp"
        android:background="@drawable/gradient" >
    </View>

    <Button
        android:id="@+id/AddRecord"
        android:layout_width="120dp"
        android:layout_height="34dp"
        android:layout_x="10dip"
        android:layout_y="71dip"
        android:text="Add"
        android:textSize="10sp" >
    </Button>

    <Button
        android:id="@+id/DeleteRecord"
        android:layout_width="120dp"
        android:layout_height="34dp"
        android:layout_x="140dp"
        android:layout_y="71dp"
        android:text="Delete"
        android:textSize="10sp" >
    </Button>

    <Button
        android:id="@+id/ClearRecord"
        android:layout_width="120dp"
        android:layout_height="34dp"
        android:layout_x="270dp"
        android:layout_y="71dp"
        android:text="Clear"
        android:textSize="10sp" >
    </Button>

    <Button
        android:id="@+id/SaveRecord"
        android:layout_width="120dp"
        android:layout_height="34dp"
        android:layout_x="400dp"
        android:layout_y="71dp"
        android:text="Save"
        android:textSize="10sp" >
    </Button>

    <View
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_y="110dp"
        android:background="@drawable/gradient" >
    </View>

    <CheckBox
        android:id="@+id/SelectAll"
        android:layout_width="wrap_content"
        android:layout_height="20dp"
        android:layout_x="10dip"
        android:layout_y="115dip"
        android:text="Select All"
        android:textSize="10sp" >
    </CheckBox>

    <TextView
        android:id="@+id/Company"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="95dip"
        android:layout_y="115dip"
        android:background="#666666"
        android:text="Company"
        android:textColor="#000000"
        android:textSize="12sp" >
    </TextView>

    <TextView
        android:id="@+id/Product"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="200dip"
        android:layout_y="115dip"
        android:background="#666666"
        android:text="Product"
        android:textColor="#000000"
        android:textSize="12sp" >
    </TextView>

    <TextView
        android:id="@+id/Code"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="300dip"
        android:layout_y="115dip"
        android:background="#666666"
        android:text="Code"
        android:textColor="#000000"
        android:textSize="12sp" >
    </TextView>

    <TextView
        android:id="@+id/Model"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="380dp"
        android:layout_y="115dp"
        android:background="#666666"
        android:text="Model"
        android:textColor="#000000"
        android:textSize="12sp" >
    </TextView>

    <TextView
        android:id="@+id/Quantity"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_x="470dp"
        android:layout_y="115dp"
        android:background="#666666"
        android:text="Quantity"
        android:textColor="#000000"
        android:textSize="12sp" >
    </TextView>

    <View
        android:id="@+id/view1"
        android:layout_width="wrap_content"
        android:layout_height="1dp"
        android:layout_x="0dip"
        android:layout_y="134dip"
        android:background="@drawable/gradient" >
    </View>

    <com.BookOrders.ObservableScrollView
        android:id="@+id/scrollContainer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_x="1dp"
        android:layout_y="140dp"
        android:clickable="true"
        android:fadeScrollbars="false"
        android:fillViewport="true" >

        <TableLayout
            android:id="@+id/OrderData"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:stretchColumns="0,1,2,3,4" />
    </com.BookOrders.ObservableScrollView>

</AbsoluteLayout>

解决方案

I worked out the solution for this. For those who would like to know can first go through the following link http://blog.stylingandroid.com/archives/447

I used this logic. However, I create rows dynamically when user clicks "Add" button. The only problem is, if you use spinner you won't be able to set its height zero.

Nitin

这篇关于Android的要使可视屏幕滚动的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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