PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
AndroidDev
[問題] linearlayout的問題
作者:
a43149
(台灣真是個寶島... 屁!)
2016-05-17 16:15:58
下面是我的layout程式碼
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:id="@+id/mybut"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="false"
android:text="@string/button"/>
<TextView
android:id="@+id/mytext"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/text"/>
</LinearLayout>
<Button
android:id="@+id/mybut1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAllCaps="false"
android:text="@string/button1"/>
<TextView
android:id="@+id/mytext1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/text"/>
</LinearLayout>
我想要讓我的textview1顯示在我的button1的旁邊
可是我這樣弄怎麼只有顯示出button1而已 其他的都沒有出現
有人可以幫我看看嗎? 謝謝!!
作者:
LZN
(秋)
2016-05-17 16:24:00
要不要先說明哪一個是textview1哪一個是button1?
作者:
king5201
(我 要 ..)
2016-05-17 17:26:00
你的layout只會出現mybut跟mytext這兩個吧...調整一下裡面LinearLayout layout_height試試?
作者: FlowerYen (Greg)
2016-05-17 17:44:00
你採用了 horizontal的linear來包你的textview跟button為了要實現"textview1顯示在我的button1的旁邊"但是你的mytext的width=match_parent 所以mybut消失了解法:使用layout_weight,或者是relative layout
繼續閱讀
[問題] 請教兩個問題1.upload data 2.viewpager
freedom74569
[問題] Webview偵測html id
james73510
[問題] 如何在手機內部存TXT檔?
puppyulove
[問題] android studio 字形求救
apout
[問題] 請問有人刷過Zenfone 6嗎
howard861025
[問題] Android Studio視窗顯示超出可視範圍
dharma
[問題] QR code 連續掃描的問題
puppyulove
[問題] webview如何取得/自動輸入使用者資料
tommy91634
[問題] 把平板當作開發版的外接觸控螢幕?
ChinaSuckMyD
[問題] Android Studio ndk-build 參數說明/出處
Avatar123
Links
booklink
Contact Us: admin [ a t ] ucptt.com