谷歌已经宣布了一种名为" ConstraintLayout " 的新布局,它应该是最终布局,可以在保持平坦(没有嵌套布局)的同时取代所有布局,并且具有更好的性能.
事情是,我几乎没有看到任何可以帮助我解决这个问题的教程,除了在Google IO上展示的视频.
我想要做的是,假设我在另一个布局中有一个垂直居中的LinearLayout - 将它们转换为单个ConstraintLayout.
毕竟,这是这个新布局的目的......
我想要处理的布局如下:
请注意,中心的视图仅垂直居中,并且2个textView位于ImageView的右侧,ImageView也垂直居中.
这一切都适用于RelativeLayout,它具有2个TextViews的LinearLayout,但我想知道如何将它们转换为单个ConstraintLayout.
这是我展示的示例XML:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?attr/listPreferredItemHeightSmall">
<ImageView
android:id="@+id/appIconImageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginEnd="4dp"
android:layout_marginLeft="2dp"
android:layout_marginRight="4dp"
android:layout_marginStart="2dp"
android:adjustViewBounds="true"
android:src="@android:drawable/sym_def_app_icon"
tools:ignore="ContentDescription"/>
<LinearLayout
android:id="@+id/appDetailsContainer"
android:layout_width="0px"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toEndOf="@+id/appIconImageView"
android:layout_toLeftOf="@+id/overflowView"
android:layout_toRightOf="@+id/appIconImageView"
android:layout_toStartOf="@+id/overflowView"
android:orientation="vertical">
<TextView
android:id="@+id/appLabelTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:text="label"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textDirection="locale"
tools:ignore="HardcodedText,UnusedAttribute"/>
<TextView
android:id="@+id/appDescriptionTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:minLines="3"
android:text="description"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textDirection="locale"
tools:ignore="HardcodedText,UnusedAttribute"/>
</LinearLayout>
<ImageView
android:id="@+id/overflowView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:adjustViewBounds="true"
android:background="?attr/selectableItemBackground"
android:clickable="true" …Run Code Online (Sandbox Code Playgroud) 我正在制作一些花哨的应用程序,需要很多短音才能使用它.几乎没有问题你可以回答.
我在android项目中存储的地方有一些限制吗?目前我把它们放在bin/res/sounds文件夹中.
是否对文件格式有限制并且.wav可以吗?
我需要一些东西来存储对那些声音的引用.我想出了一个字典,它包含一个声音名称(键)和一个文件路径,所以我可以使用这种方法:
mp = MediaPlayer.create(Test.this, R.raw.mysound);
我应该如何存储R.raw.mysound,它不是一个字符串对吗?
我道歉如果我对一切都不太清楚,我会尽我所能.干杯
我正在开发Q/A应用程序.我已成功加载firebase的问题.但我无法从Firebase中应用分页数据库.如何识别我们已经到达了回收站视图的末尾,以便可以加载下几个问题.
pagination android firebase android-recyclerview firebase-realtime-database
我在与android,博客等相关的书籍的各个地方看到'gson'这个词.它是否与kml相似或者它是不同的.
android ×4
android-file ×1
firebase ×1
gson ×1
ios ×1
json ×1
kml ×1
pagination ×1
react-native ×1
reactjs ×1