首页 > 其他分享 >保证editView大小不变防止输入过多变形以及TextView的style引用

保证editView大小不变防止输入过多变形以及TextView的style引用

时间:2023-06-20 18:06:17浏览次数:33  
标签:style right text content editView wrap TextView fill


<TableLayout  
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:stretchColumns="1" 
android:padding="5dip"> 
<TableRow> 
    <TextView 
        android:id="@+id/label1" 
        android:text="@string/label1text" 
        android:layout_column="0" 
        style="@style/label" 
        /> 
    <EditText  
        android:id="@+id/edit1" 
        android:layout_column="1" 
        style="@style/edit" 
        /> 
</TableRow>

 

<style name="label" parent="@android:style/Widget.TextView"> 
    <item name="android:gravity">right</item> 
    <item name="android:paddingRight">5dip</item> 
    <item name="android:paddingTop">15dip</item> 
    <item name="android:layout_width">wrap_content</item> 
    <item name="android:layout_height">wrap_content</item> 
</style> 
<style name="edit" parent="@android:style/Widget.EditText"> 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:layout_height">0</item>
<item name="android:layout_weight">1</item>
    <item name="android:scrollHorizontally">true</item> 
    <item name="android:fadingEdge">vertical</item> 
    <item name="android:inputType">text</item> 
</style>

 红色部分就是要设置的。

 

<TableLayout android:id="@+id/homelayout" 
                        android:layout_width="fill_parent" android:layout_height="fill_parent"> 
                        <TableRow> 
                        <TextView android:id="@+id/labelartist" 
                                android:layout_width="fill_parent" android:layout_height="wrap_content" 
                                android:text="Find artists:" /> 
                        </TableRow> 
                        <TableRow> 
                                <EditText android:id="@+id/entryartist" 
                                        android:layout_width="wrap_content" android:layout_height="0" 
                                        android:background="@android:drawable/editbox_background" 
                                        android:singleLine="true" 
                                        android:editable="true" 
                                        android:layout_weight="3" 
                                        android:padding="5px" 
                                         /> 
 
                                <Button android:id="@+id/okartist" android:layout_width="wrap_content" 
                                        android:layout_height="wrap_content" 
                                        android:layout_alignParentRight="true" android:layout_marginLeft="10dip" 
                                        android:layout_weight="1" 
                                        android:text="Search" /> 
                        </TableRow> 
                </TableLayout>

 

标签:style,right,text,content,editView,wrap,TextView,fill
From: https://blog.51cto.com/u_16166892/6523990

相关文章

  • 让editView、AutoCompleteTextView开始捕获的焦点
    让在我的项目中有一个listView还有一个AutoCompleteTextView,我不想一运行AutoCompleteTextView就获得焦点试了一下午没找到方法最终用了一个本办法<LinearLayoutandroid:focusable="true"android:focusableInTouchMode="true"android:layout_width="0px"android:layou......
  • vue学习第16天 CSS---3D转换 (translate3d 3d移动、3D旋转 rotate3d、transform-
    3D转换转换:1)3d移动 translate3d 2)3d旋转 rotate3d 3D的特点:1)近大远小2)物体后面遮挡不可见 3D转换:我们工作最常用的 3D位移 和 3D旋转 主要知识点: 1、三维坐标系(z轴,z外(屏幕)+,z内(屏幕)-)三维......
  • SAP Spartacus 开源项目中 $skipComponentStyles 的作用介绍
    SAPSpartacus和Angular开发的前端应用中的$skipComponentStyles是用于跳过组件样式加载的一个标志。在理解$skipComponentStyles的作用之前,我们先来了解一下SAPSpartacus。SAPSpartacus是一个开源的电子商务前端框架,用于构建可扩展、可定制的电子商务网站。它基于An......
  • 脚踩Midjourney、Stable Diffusion,谷歌StyleDrop真要杀疯了!
    脚踩Midjourney、StableDiffusion,谷歌StyleDrop真要杀疯了导语StyleDrop组件MuseMuse架构Muse图像生成实现流程适配器微调AdapterTuningMuse中的AdapterTuning反馈迭代训练最近,谷歌发布了一款引人瞩目的AI绘画工具——StyleDrop。这个工具通过学习特定的艺术风格,能够根据文字......
  • vue 报错 !!vue-style-loader!css-loader?{“sourceMap“:true}!.
    npmrundev报错Thesedependencieswerenotfound:*!!vue-style-loader!css-loader?{"sourceMap":true}!../../node_modules/vue-loader/lib/style-compiler/index?{"vue":true,"id":"data-v-858b20d4","scoped":true,......
  • WPF中的Style(2)
    1、Style中的TriggerTrigger:触发器,即当某些条件满足时会触发一个行为。Trigger是最基本的触发器,Trigger也有Property和Value这两个属性,Property是Trigger的属性名称,Value是触发条件。Trigger类还有Setters属性,此属性值是一组Setter,一旦触发条件被满足,这组Setter设定的属性值就会被......
  • EndNote参考文献格式Output Styles界面介绍
      本文对EndNote软件修改论文参考文献引用格式的界面与各选项参数加以详细介绍。  利用EndNote软件进行论文参考文献的插入可以说是非常方便;但其亦具有一个问题,就是对中文文献的支持不太友好;之前也用过NoteExpress,这一国产软件对于中文参考文献的支持性很好,但是由于论文较多,......
  • vue3配置stylelint
    stylelint为css的lint工具,可格式化css代码,检查css语法错误与不合理的写法,指定css书写顺序等。以scss作为预处理器为例,看如何配置stylelint1.安装以下依赖pnpmaddsasssass-loaderstylelintpostcsspostcss-scsspostcss-htmlstylelint-config-prettierstylelint-......
  • WPF中的Style(风格,样式)
    在WPF中我们可以使用Style来设置控件的某些属性值,并使该设置影响到指定范围内的所有该类控件或影响指定的某一控件,比如说我们想将窗口中的所有按钮都保持某一种风格,那么我们可以设置一个Style,而不必分别设置每个按钮的风格。Style是作为一种资源被保存下来的.看下面的例子:<Window.......
  • 如何使用TypeScript和Styled-Components构建图像轮播组件
    近年来,OTT(over-the-top)视频流媒体平台变得更加创新和易于使用。在他们的用户界面中,电影和连续剧的标题排列得清晰可见。在本教程中,我将指导您完成创建图像轮播组件的过程,该组件看起来就像您在许多OTT平台(想想Netflix)上看到的一样。我们将从创建原子组件开始,例如Tags、Descrip......