久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

TableRow中的Android固定寬度EditText

Android fixed width EditText within TableRow(TableRow中的Android固定寬度EditText)
本文介紹了TableRow中的Android固定寬度EditText的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

限時(shí)送ChatGPT賬號(hào)..

我完全無(wú)法在 TableRow 中獲取固定寬度的 EditText 小部件.我正在嘗試以相同的寬度(大約 20dip)并排放置兩個(gè) EditText,但無(wú)論我嘗試設(shè)置哪個(gè)屬性并將第一個(gè) EditText 設(shè)置為很長(zhǎng)并且顯然無(wú)法調(diào)整大小.

I'm completely stuck trying to get fixed width EditText widgets in a TableRow. I am attempting to place two EditText side by side with equal width (about 20dip) but no matter which property I try and set the first EditText is way to long and apparently cannot be resized.

非常感謝:

<TableRow 
  android:layout_height="wrap_content"
  android:baselineAligned="false" 
  android:id="@+id/tableRow3" 
  android:gravity="center"
  android:stretchColumns="1" 
  android:layout_width="match_parent">
  <TextView 
    android:id="@+id/textView6" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="1" 
    android:paddingLeft="36dip">
  </TextView>
  <EditText
    android:layout_height="wrap_content" 
    android:id="@+id/editText2" 
    android:inputType="number" 
    android:layout_width="20dip">
  </EditText>
  <EditText 
    android:layout_height="wrap_content" 
    android:id="@+id/editText1" 
    android:inputType="number"
    android:layout_width="wrap_content">
    <requestFocus></requestFocus>
  </EditText>
</TableRow>

推薦答案

我不知道 TableLayout 是不是最好的方法,它可能很麻煩,除非你顯示大量數(shù)據(jù)并且需要使用它.

I don't know that a TableLayout is the best way to do this, it can be cumbersome unless you're displaying large amounts of data and need to use it.

我發(fā)現(xiàn)確保表單對(duì)象按照我想要的方式分配長(zhǎng)度的最佳方法之一是使用權(quán)重而不是顯式聲明寬度.

One of the best ways I've found to ensure that form objects have length distributed the way I want them is by using weight rather than explicitly declaring width.

嘗試以下方法:

<LinearLayout ... android:orientation="horizontal" ... 
android:layout_width="match_parent" android:layout_height="wrap_content"
<TextView ... android:layout_width="0dp" ... android:layout_weight="50" />
<TextView ... android:layout_width="0dp" ... android:layout_weight="50" />
</LinearLayout>

確保將布局寬度聲明為 0,這將使布局填充到權(quán)重.

Make sure to declare the layout width as 0, this will let the layout fill to the weight.

這應(yīng)該會(huì)在屏幕上創(chuàng)建兩個(gè)相鄰的 TextView,它們都占據(jù)了 50% 的屏幕.你可以玩不同的百分比.您還可以使用 LinearLayout 作為占位符,其權(quán)重為您希望放置的任何 %.

This should create two TextViews next to each other on the screen, both filling 50% of the screen. You can play with different percentages. You can also use a LinearLayout as a placeholder with a weight of whatever % you would like to place hold.

確保您的權(quán)重"加起來(lái)為 100,以確保視圖看起來(lái)完全符合您的要求.這不是必需的,但知道它將占據(jù)屏幕寬度的百分比是一個(gè)很好的約定.

Make sure that your "weights" add up to 100 in order to ensure the view will look exactly as you want it to. It's not necessary, but it's a good convention to know what % of the screen width it will take up.

這篇關(guān)于TableRow中的Android固定寬度EditText的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Cut, copy, paste in android(在android中剪切、復(fù)制、粘貼)
android EditText blends into background(android EditText 融入背景)
Change Line Color of EditText - Android(更改 EditText 的線條顏色 - Android)
EditText showing numbers with 2 decimals at all times(EditText 始終顯示帶 2 位小數(shù)的數(shù)字)
Changing where cursor starts in an expanded EditText(更改光標(biāo)在展開(kāi)的 EditText 中的開(kāi)始位置)
EditText, adjustPan, ScrollView issue in android(android中的EditText,adjustPan,ScrollView問(wèn)題)
主站蜘蛛池模板: 日本福利视频免费观看 | 久久国产综合 | 久久99精品久久久久久狂牛 | 亚洲国产一区二区视频 | 在线一级片 | 欧美一级片a | av av在线| 欧美亚洲国语精品一区二区 | 久久久久高清 | 天天综合网91 | 欧美激情欧美激情在线五月 | 欧美日韩大片 | 国产视频综合 | 中文精品一区二区 | 99精品网 | 国产高清视频 | 一本岛道一二三不卡区 | 欧美在线一区二区三区 | 亚洲国产精品va在线看黑人 | 99久久精品一区二区毛片吞精 | 亚洲精品乱码久久久久久按摩 | 欧美三区 | 精品国产一区二区在线 | 精品国产一区二区三区久久影院 | 在线 丝袜 欧美 日韩 制服 | 欧美另类日韩 | 久久一二区 | 欧美视频在线播放 | 欧美日韩精品在线免费观看 | 亚洲欧美视频一区 | 成人精品久久日伦片大全免费 | 91精品国产综合久久福利软件 | 国产成人高清在线观看 | 午夜影院在线观看免费 | 久久99精品久久久久久 | 国产精品一二三区 | 一区二区三区四区视频 | 日韩视频中文字幕 | 看av网| 中文字幕不卡视频在线观看 | 二区高清 |