您可以很容易地在页面加载时使用Javascript或Jquery做到这一点。
jQuery:
<Second>
name: "screen2"
FloatLayout:
ScrollView:
do_scroll_y: True
do_scroll_x: True
GridLayout:
spacing:20
padding: 20
size_hint: 1,None
# height: 500
height: self.minimum_height
cols:1
on_kv_post:
for i in range(root.no_widgets): root.dynamic_labels.append(Label(size_hint = (0.1,None),height = 30))
for wid in range (root.no_widgets): self.add_widget(root.dynamic_labels[wid])
root.set_data()
Javascript:
$(function(){//executes when dom is ready
var textAreaAdjust = function(control) {//function to set the height
$(control).height(1);
$(control).height($(control).prop('scrollHeight'));
}
textAreaAdjust($('#txt'));// call the function passing the textarea control in
});
对此answer
的信用
,
您可以使用文字控件
<asp:Literal ID="Literal1" runat="server"></asp:Literal>
或添加了runat="server"
的html div。
<div id="specialDiv" runat="server"></div>
c#
specialDiv.InnerText = "asdfasdf...etc";
请注意,如果您使用CssClass="form-control"
,则可能必须通过将height
设置为auto
而不是预设/硬编码高度来更新css。
本文链接:https://www.f2er.com/3150735.html