在Scene2D - LIBGDX中的SelectBox内设置LabelCell的位置

时间:2015-05-18 08:11:39

标签: libgdx scene2d

我有 SelectBox ;如何定位所选项目文本(标签单元格)?例如,在TextButton中,每当我想重新定位文本时,我都会使用<?php $this->module->daftarkanJs('underscore-min.js'); $form = CJSON::decode(file_get_contents(Yii::app()->getBaseUrl(true).'/index.php/odk/api/index/id/'.$_GET['id'])); $input = CJSON::decode(file_get_contents(Yii::app()->getBaseUrl(true).'/index.php/odk/api/input/id/'.$_GET['id'])); function haveChild($id, $input_id){ $child = CJSON::decode(file_get_contents(Yii::app()->getBaseUrl(true).'/index.php/odk/api/child/id/'.$id.'/parentId/'.$input_id)); if($child['result']){ // jika child ada foreach($child['result'] as $data){ // echo '- <b>'.$data['input_id'].'</b><br/>'; haveChild($id, $data['input_id']); } return true; }else{ return false; } } function loop($inputResult, $id){ $dom = new DOMDocument('1.0', 'utf-8'); $dom->preserveWhiteSpace = false; $dom->formatOutput = true; $html = $dom->createElementNS('http://www.w3.org/2002/xforms', 'h:html'); $html->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:h', 'http://www.w3.org/1999/xhtml'); $html->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:ev', 'http://www.w3.org/2001/xml-events'); $html->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); $html->setAttributeNS('http://www.w3.org/2000/xmlns/' ,'xmlns:jr', 'http://openrosa.org/javarosa'); $html = $dom->appendChild($html); $head = $dom->createElement('h:h'); $head = $html->appendChild($head); $title = $dom->createElement('h:t', 'xxxxxxx'); $title = $head->appendChild($title); $model = $dom->createElement('m'); $model = $head->appendChild($model); $instance = $dom->createElement('instance'); $instance = $model->appendChild($instance); $data = $dom->createElement('data'); $data = $instance->appendChild($data); $meta = $dom->createElement('meta'); $meta = $data->appendChild($meta); $instanceID = $dom->createElement('instaceID'); $instanceID = $meta->appendChild($instanceID); $bind = $dom->createElement('bind'); $bind->setAttribute("nodeset","/data/meta/instanceID"); $bind = $model->appendChild($bind); foreach($inputResult as $data){ if(!$data['parent_id']){ // ambil yang bukan child $check = haveChild($id, $data['input_id']); if(!$check){ $data = $dom->createElement('data'); $data = $instance->appendChild($data); $meta = $dom->createElement('meta'); $meta = $data->appendChild($meta); $bind = $dom->createElement('bind'); $bind->setAttribute("nodeset","/data/".str_replace(" ", "_", $data['name'])); $bind = $model->appendChild($bind); } } } $body = $dom->createElement('h:b'); $body = $html->appendChild($body); printf ("<pre>%s</pre>", htmlentities ($dom->saveXML())); } loop($input['result'], $_GET['id']); ?>;什么可以用于SelectBox actor,因为没有getLabelCell?

1 个答案:

答案 0 :(得分:0)

select_box.background.setLeftWidth(DX_VALUE);

修改文本的左边距。这对我很有用,因为添加到列表中的所有文本都具有大致相同的字符长度,因此具有相同的宽度。