android-layout-weight

How can I give my widgets' width a percentage rather than an explicit value?

我们两清 提交于 2020-01-23 09:33:27
问题 Based on how XAML works, I thought I could give my android widgets a percentage value for width. After searching, I found that *theoretically," this is available via the "layout_weight" property. But using this does not produce the desired appearance. Specifically, this xml: <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dp"> <Spinner android:id="@+id/spinnerUPCPLU" android:layout_width="0dp" android

How can I give my widgets' width a percentage rather than an explicit value?

旧城冷巷雨未停 提交于 2020-01-23 09:32:35
问题 Based on how XAML works, I thought I could give my android widgets a percentage value for width. After searching, I found that *theoretically," this is available via the "layout_weight" property. But using this does not produce the desired appearance. Specifically, this xml: <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" android:padding="5dp"> <Spinner android:id="@+id/spinnerUPCPLU" android:layout_width="0dp" android

Android - TextView's Weight Property in LinearLayout is being ignored when used as ListView row View

这一生的挚爱 提交于 2020-01-16 10:00:20
问题 I have a CustomListView, when I longClick on a row, the layout of that row changes to a different listRow Layout. So far, everything is working, however, the layout of the new view is compressed. Here are my xml files: search_result_layout.xml --> this is the original xml file used by the customListView Adapter. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/search_result_layout" android:layout_width="fill

layout_weight with buttons and text views in table row

左心房为你撑大大i 提交于 2019-12-30 11:51:49
问题 I am trying to make four rows of three buttons each, and at the bottom of the buttons are two text views. I would like for them all to be spaced evenly but they aren't and I am not sure why. Here is the code in my main.xml file. <?xml version="1.0" encoding="utf-8"?> <TableLayout android:id="@+id/TableLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android"> <TableRow android:id="@+id/TableRow01" android:layout

imageview weights in linearlayout

本秂侑毒 提交于 2019-12-24 08:56:22
问题 I have this layout: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical" android:orientation="horizontal" android:minWidth="100dp" > <TextView android:id="@+id/txt_what_way" android:layout_height="wrap_content" android:layout_width="0dp" android:layout_weight="4" android:textAppearance="?android:attr/textAppearanceMedium" />

Understanding android:layout_weight

99封情书 提交于 2019-12-23 20:04:51
问题 Why the following listing shows only the second TextView (red)? <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:text="11111" android:background="#00FF00" /> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android

How to use weightSum in RelativeLayout

↘锁芯ラ 提交于 2019-12-23 06:18:30
问题 I just Created a Relative Layout with id rl1 What I need I want to create a weightSum with 2 for this relative layout as to put in this layout another 2 relative layout one with id fireID and the other relative layout cartID which each of them take a weight 1 how can I silve this issue this is my xml file <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap

How to make two different layout to have same height?

戏子无情 提交于 2019-12-23 01:48:08
问题 In My application XML layout, I have one Relativelayout, In which there are two linear Layout. Now I am doing the animation for that both layout. But because thera seems the height different I got some view problem. So I want to make the same height of the both layout. Below is my XML file. <!-- ============================================================= --> <!-- BOTTLE / PEN LAYOUT --> <!-- ============================================================= --> <LinearLayout android:layout

Android TextView does not expand to match parent

点点圈 提交于 2019-12-22 11:23:20
问题 I have a viewgroup like this image: I want to not show those texts that are empty. For example, assume that I have no tips and promo then just Notes should be visible. When I test my program Notes (displayed with red background) does not expand to fill parent although its width set to match parent. Any idea would be appreciated. Thanks. <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/llNotesContainer" android

How do I set android:layout_columnWeight=“1” programmatically to an element in an android support v7 Gridlayout

泪湿孤枕 提交于 2019-12-21 06:47:09
问题 I'm trying to build a GirdLayout programmatically with 2 columns and I want these columns to have equal width set at half the width of the screen. I figured out you can do this since API 21 or with the support v7 GirdLayout view. I see examples that uses android:layout_columnWeight="1" to do this. But I can not find how to do this programmatically. Can anyone help me with this matter? package com.tunify.v3.component; import java.util.ArrayList; import android.support.v7.widget.GridLayout;