在DroidScript中添加线性layuots中的控件是否存在限制?

时间:2016-07-27 16:07:39

标签: android droidscript

我有一个问题,我开始开发一个应用程序的UI,并在这个项目的一个框架中我添加了25个控件,但我需要添加更多,当我尝试添加复选框文本和编辑文本只显示编辑文本,文本和chek没有出现,在我的代码中我有以前放的检查和文本。 我该怎么办?,我试图看到控件只有在框架外创建控件时才会移动每个控件的边距,只要应用案例,但是不起作用,控件就不会出现。 这是代码:

//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
lay.SetBackColor( "#00bcff" );  
lframe  = app.CreateLayout( "linear","left,FillXY");
lframe.SetBackColor( "#5f5f5f" );
lframe.SetVisibility( "Show" );

//Creando ventanitas de app
//Creando ventana crear examen, encuesta
Vlc = app.CreateLayout( "Linear","left,FillXY" );
//Vlc.SetSize( 100,100 );
Vlc.SetVisibility( "Hide" );
Vlc.SetBackColor( "#008200" );
Vlc.SetMargins( 0.025, 0.001, 0.025, 0.025 );

//titulo ventana
var Tx = "<u>Crear</u>"
Titvlc = app.CreateText( Tx,0.6,-1,"Html" );
Titvlc.SetTextColor( "#000000" );
Titvlc.SetTextSize( 16 );
Titvlc.SetMargins( 0.15, 0.01, 0.01, 0.01 );
Vlc.AddChild( Titvlc );

//txtpara guardar el archivo
Txtar = app.CreateText( "Nombre del Archivo:" );
Txtar.SetTextColor( "#000000" );
Txtar.SetTextSize( 12 );
Txtar.SetMargins( 0.025, 0.01, 0.01, 0.01 );
Tedna = app.CreateTextEdit( "",0.5,0.040 );
Tedna.SetTextColor( "#000000" );
Tedna.SetTextSize( 12 );
Tedna.SetMargins( 0.30, -0.04, 0.01, 0.01 );
Vlc.AddChild( Txtar );
Vlc.AddChild( Tedna );

//Selección del tipo de atchivo y cuestionario
var Txc = "<u>Tipo de Cuestionario:</u>"
var Txp = "<u>Tipo de Pregunta:</u>"
Barrah = app.CreateImage( null, 0.9,0.01 );
Barrah.SetPaintColor( "#000000" );
Barrah.DrawLine( 0.0,0.1,1.0,0.1 );
Barrah.SetMargins( 0.025, 0.0, 0.0, 0.0 );

Barrav = app.CreateImage( null, 0.01,0.2 );
Barrav.SetPaintColor( "#000000" );
Barrav.DrawLine( 0.0,0.1,0.0, 0.8 );
Barrav.SetMargins( 0.35, -0.12, 0.0, 0.0 );
//titulo 1
Txtc = app.CreateText( Txc,0.3,-1,"Html" );
Txtc.SetTextColor( "#000000" );
Txtc.SetTextSize( 12 );
Txtc.SetMargins( 0.02, 0.0, 0.0, 0.0 );
Rbtc1 = app.CreateCheckBox( "Encuesta" );
Rbtc1.SetTextSize( 12 );
Rbtc1.SetMargins( 0.02, 0.0, 0.0, 0.0 );
Rbtc2 = app.CreateCheckBox( "Examen" );
Rbtc2.SetTextSize( 12 );
Rbtc2.SetMargins( 0.02, 0.0, 0.0, 0.0 );
// Segundo título
Txtp = app.CreateText( Txp,0.3,-1,"Html" );
Txtp.SetTextSize( 12 );
Txtp.SetTextColor( "#000000" );
Txtp.SetMargins( 0.35, -0.181, 0.0, 0.0 );
// RadioButtons
// Rbtp1
Rbtp1 = app.CreateCheckBox( "INR" );
Rbtp1.SetTextSize( 12 );
Rbtp1.SetMargins( 0.38, 0.0, 0.0, 0.0 );
// Rbtp2
Rbtp2 = app.CreateCheckBox( "IRM1R" );
Rbtp2.SetTextSize( 12 );
Rbtp2.SetMargins( 0.38, 0.0, 0.0, 0.0 );
// Rbtp3
Rbtp3 = app.CreateCheckBox( "IRMMR" );
Rbtp3.SetTextSize( 12 );
Rbtp3.SetMargins( 0.38, 0.0, 0.0, 0.0 );
// Rbtp4
Rbtp4 = app.CreateCheckBox( "RM1R" );
Rbtp4.SetTextSize( 12 );
Rbtp4.SetMargins( 0.58, -0.09, 0.0, 0.0 );
// Rhtp5
Rbtp5 = app.CreateCheckBox( "RMMR" );
Rbtp5.SetTextSize( 12 );
Rbtp5.SetMargins( 0.58, 0.0, 0.0, 0.0 );
//barrah2
barrah2 = app.CreateImage( null, 0.9,0.01 );
barrah2.SetPaintColor( "#000000" );
barrah2.DrawLine( 0.0,0.1,1.0,0.1 );
barrah2.SetMargins( 0.025, 0.03, 0.0, 0.0 );
//ID Cuestionario
Txid = app.CreateText( "ID del Cuestionario:" );
Txid.SetTextColor( "#000000" );
Txid.SetTextSize( 12 );
Txid.SetMargins( 0.03, 0.0, 0.0, 0.0 );

//texto que muestra el id autogenerado
Txidd = app.CreateText( "  " );
Txidd.SetTextColor( "#000000" );
Txidd.SetTextSize( 12 );
Txidd.SetBackColor( "#7f7f7f" );
//Txidd.SetText( "12" );
Txidd.SetMargins( 0.30, -0.027, 0.0, 0.0 );

//opcion para imprimir numeros
Tximpn = app.CreateText( "¿Imprimir Números?" );
Tximpn.SetTextSize( 12 );
Tximpn.SetTextColor( "#000000" );
Tximpn.SetMargins( 0.35,- 0.03, 0.0, 0.0 );

//spinner de los números
l="Sel,0,1,2";
spn = app.CreateSpinner( l,0.12 );
spn.SetTextSize( 12 );
spn.SetTextColor( "#000000" );
spn.SetMargins( 0.43,-0.0,0.0, 0.0 );

//Opciones
Txop = app.CreateText( "Opciones:" );
Txop.SetTextSize( 12 );
Txop.SetTextColor( "#000000" );
Txop.SetMargins( 0.70, -0.07, 0.0, 0.0 );

//numerador
var n=100;
var l2="";
//estas opciones deven de leer los números de orden ya programados y excluirlos de la lista en cada cambio
for(var i=1;i<=n;i++){
    if(i==n){
        l2=l2+ new String(i);//
    }else{
        l2=l2 + new String(i) +",";//
    }
}
num = app.CreateSpinner( l2,0.12 );
num.SetTextSize( 12 );
num.SetTextColor( "#000000" );
num.SetMargins( 0.70, 0.0, 0.0, 0.0 );

//texto indicativo de la pregunta
Tp = app.CreateText( "Escriba la pregunta " );
Tp.SetTextSize( 12 );
Tp.SetTextColor( "#000000" );
Tp.SetMargins( 0.025, -0.03, 0.01, 0.01 );

//text area para capturar la pregunta
Ta1 = app.CreateTextEdit( "",0.9,0.15,"Left Bold" );
Ta1.SetTextSize( 12 );
Ta1.SetTextColor( "#000000" );
Ta1.SetBackColor( "#33ffffff" );
Ta1.SetMargins( 0.025, -0.01, 0.01, 0.01 );

//srparador horizontal
barrah3 = app.CreateImage( null, 0.9,0.01 );
barrah3.SetPaintColor( "#000000" );
barrah3.DrawLine( 0.0,0.1,1.0,0.1 );
barrah3.SetMargins( 0.025, 0.0, 0.0, 0.0 );

//texto para escribir las respuestas
Tr = app.CreateText( "Escriba la Respuesta " );
Tr.SetTextSize( 12 );
Tr.SetTextColor( "#000000" );
Tr.SetMargins( 0.025, 0.0, 0.01, 0.01 );

//indicador de respuestas
Ir = app.CreateText( "Respuestas: " );
Ir.SetTextSize( 12 );
Ir.SetTextColor( "#000000" );
Ir.SetMargins( 0.65, -0.038, 0.01, 0.01 );

//barra horizontal psra el número de Respuestas
Barrah4 = app.CreateImage( null, 0.5,0.01 );
Barrah4.SetPaintColor( "#000000" );
Barrah4.DrawLine( 0.0,0.1,0.21,0.1 );
Barrah4.SetMargins( 0.82, -0.01, 0.01, 0.01 );

//textedit para las respuestas
Txr = app.CreateTextEdit( "",0.9,0.15,"Left Bold" );
Txr.SetTextSize( 12 );
Txr.SetTextColor( "#000000" );
Txr.SetBackColor( "#33ffffff" );
Txr.SetMargins( 0.025, -0.01, 0.01, 0.01 );

//check respuedta correcta
Dfr = app.CreateText( "hola" );
Dfr.SetTextSize( 12 );
Chr = app.CreateCheckBox( "Respuesta correcta" );
Chr.SetTextSize( 12 );
Chr.SetTextColor( "#000000" );
Chr.SetMargins( 0.01, 0.01, 0.01, 0.01 );

//texto valor
Txv = app.CreateText( "Valor: " );
Txv.SetTextSize( 12 );
Txv.SetTextColor( "#000000" );
Txv.SetMargins( 0.01, 0.01, 0.01, 0.01 );

//text edit para capturar el valor de la respuesta correcta
Txtv = app.CreateTextEdit( "",0.1,0.04 );
Txtv.SetTextSize( 12 );
Txtv.SetTextColor( "#000000" );
Txtv.SetBackColor( "#33ffffff" );
Txtv.SetMargins( 0.03, 0.01, 0.01, 0.0 );
// Add to Vlc
Vlc.AddChild( Barrah );
Vlc.AddChild( Txtc );
Vlc.AddChild( Rbtc1 );
Vlc.AddChild( Rbtc2 );
Vlc.AddChild( Barrav );
Vlc.AddChild( Txtp );
Vlc.AddChild( Rbtp1 );
Vlc.AddChild( Rbtp2 );
Vlc.AddChild( Rbtp3 );
Vlc.AddChild( Rbtp4 );
Vlc.AddChild( Rbtp5 );
Vlc.AddChild( barrah2 );
Vlc.AddChild( Txid );
Vlc.AddChild( Txidd );
Vlc.AddChild( Tximpn );
Vlc.AddChild( spn );
Vlc.AddChild( Txop );
Vlc.AddChild( num );
Vlc.AddChild( Tp );
Vlc.AddChild( Ta1 );
Vlc.AddChild( barrah3 );
Vlc.AddChild( Tr );
Vlc.AddChild( Ir );
Vlc.AddChild( Barrah4 );
Vlc.AddChild( Txr );
Vlc.AddChild( Dfr );
Vlc.AddChild( Chr );//->not appear
Vlc.AddChild( Txv );//->not appear
Vlc.AddChild( Txtv );//->this appear

//Creando ventana aplica examen, encuesta
//  Vlaplica

//Creando ventana califica examen, encuesta 
//  Vlcal

//Creando la ventana graficar
//Vlgraf
//Crate de first Spinner
sp = app.CreateSpinner("Seleccione:,Crear,Aplicar,Calificar,Graficar",0.25  );
sp.SetMargins( 0.01, 0, 0.01, 0 );
sp.SetOnChange( seleccion );
sp.SelectItem( null );
//Create a text label and add it to layout.
txt = app.CreateText( "Creador de Encuesyas y Exámenes V0.1 Alpha" );
txt.SetTextSize( 16 );
txt.SetTextColor( "#000000" );
txt1  = app.CreateText( "Menú " );
txt1.SetTextSize( 16 );
txt1.SetTextColor( "#000000" );
txt1.SetMargins( 0.07, 0.01, 0.01, 0 );
lay.AddChild( txt );
lframe.AddChild( txt1 );
lframe.AddChild( sp );
//Add layout to app.    
app.AddLayout( lay );
lay.AddChild(lframe );
lframe.AddChild( Vlc );
}

function seleccion(sel)
{//ini seleccion
    switch(sel){
        case "Crear":
            app.ShowPopup( "Entró a crear","short Bottom" );
            Vlc.SetVisibility( "Show" );
            //app.ShowPopup( Titvlc.GetWidth(  ));
            break;
        case "Aplicar":
            app.ShowPopup( "Entró a Aplicar" );
            break;
        case "Calificar":
            app.ShowPopup( "Entró a Calificar" );
            break;
        case "Graficar":
            app.ShowPopup( "Entró a Graficar" );
            break;
        case "Seleccione:":
            app.ShowPopup( "Escoja una opción de la lista del combo!!!" );
            break;
    }
}//end seleccion

这会生成下一个屏幕:

The screen width a problem missing controls

请你能帮帮我吗?

1 个答案:

答案 0 :(得分:1)

您需要将控件包装在滚动条中。

40;"blue-collar";"married";"secondary";"no";1100;"yes";"no";"unknown";29;"may";660

这可确保通过滚动可以看到不在视野范围内的控件。