Code Monkey home page Code Monkey logo

Comments (5)

yizems avatar yizems commented on July 24, 2024

你的item 外层viewgroup 的高度 应该是wrap_content吧,,不对,listview的item高度其实就是wrap_content

from android-percent-support-extend.

carozhu avatar carozhu commented on July 24, 2024

@qq530402037 请问下你是怎么做的,我怎么搞在列表里也显示不出来。如下:

<com.zhy.android.percent.support.PercentLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="0dp"
android:layout_height="0dp"
android:orientation="vertical"
app:layout_heightPercent="100%sh"
app:layout_widthPercent="100%sw" >

<TextView
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:background="#00000000"
    android:gravity="center_horizontal|bottom"
    android:text="星期二"
    android:textColor="@color/white"
    app:layout_heightPercent="35%sh"
    app:layout_textSizePercent="18%sh"
    app:layout_widthPercent="100%" />

<ImageView
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_gravity="center"
    android:src="@drawable/s_overcast_day"
    app:layout_heightPercent="30%sh"
    app:layout_marginTopPercent="5%"
    app:layout_widthPercent="30%" />

<TextView
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:background="#00000000"
    android:gravity="center"
    android:text="16°-24°"
    android:textColor="@color/white"
    app:layout_heightPercent="35%sh"
    app:layout_textSizePercent="18%sh"
    app:layout_widthPercent="100%" />

</com.zhy.android.percent.support.PercentLinearLayout>

from android-percent-support-extend.

qq530402037 avatar qq530402037 commented on July 24, 2024

<com.zhy.android.percent.support.PercentLinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:background="@android:color/holo_green_light"
    android:text="啊啊啊啊啊啊啊啊啊啊"
    android:gravity="center"
    app:layout_heightPercent="20%h"
    app:layout_widthPercent="80%w"
    app:layout_textSizePercent="5%w"
    />

<com.zhy.android.percent.support.PercentLinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal">

    <TextView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@android:color/holo_blue_light"
        android:text="aaa"
        android:gravity="center"
        app:layout_heightPercent="20%sh"
        app:layout_widthPercent="40%sw"
        app:layout_textSizePercent="5%w"
        />

    <TextView
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:background="@android:color/holo_blue_light"
        android:text="bbbbb"
        android:gravity="center"
        app:layout_heightPercent="20%sh"
        app:layout_widthPercent="40%sw"
        app:layout_textSizePercent="5%w"
        />
</com.zhy.android.percent.support.PercentLinearLayout>

</com.zhy.android.percent.support.PercentLinearLayout>
sw sh在预览图里就是不显示的
而且还有个问题,一个item同一行的两个控件,要么都用w,sw,要么都用sh,如果s,sw 和sh混用,就会出现两个控件设定高度一样但实际显示高度不一样的情况

from android-percent-support-extend.

cjcj125125 avatar cjcj125125 commented on July 24, 2024

您好,弱弱的问一下: 对于值可以取:10%w , 10%h , 10% , 10%sw , 10%sh

这里的sw 和sh 是什么意思??

from android-percent-support-extend.

yizems avatar yizems commented on July 24, 2024

@cjcj125125 screen w/h 屏幕宽度高度 ,w/h是基于父View的,sw/sh是基于屏幕的

from android-percent-support-extend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.