- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
解释: 我想在我的布局边框上设置我的 circleImageView。
这是我的 xml 文件,其中有更多布局,但我想在布局的边框上设置 circleimageview。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
tools:context="com.angelnx.angelnx.holidays.Registration">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:layout_margin="25dp">
<ScrollView
android:fillViewport="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/viewA"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="0.8"
android:background="@color/login_header"
android:orientation="vertical">
<ImageView
android:id="@+id/symbol"
android:contentDescription="@null"
android:layout_width="fill_parent"
android:layout_height="100dp"
android:layout_gravity="center"
android:src="@drawable/ic_menu_camera"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="75dp"
android:text="@string/Holiday"
android:layout_marginTop="50dp"
android:layout_gravity="center_horizontal|bottom"
android:gravity="center"
android:layout_alignBottom="@+id/symbol"
android:textColor="@color/header_text"
android:textStyle="bold"
android:textSize="20sp"/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:src="@drawable/circularimage"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/viewB"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="@color/fab_tint"
android:layout_weight="1"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:src="@drawable/ic_username"/>
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="text"
android:paddingLeft="30dp"
android:hint="@string/hint_name" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:src="@drawable/ic_email" />
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textEmailAddress"
android:paddingLeft="30dp"
android:hint="@string/hint_email" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:contentDescription="@null"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:src="@drawable/lock_open" />
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:inputType="textPassword"
android:paddingLeft="30dp"
android:hint="@string/hint_password" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btn_select"
android:textAllCaps="false"
android:textSize="17sp"
android:background="@color/btn_start_color"
android:textColor="@color/text_white"/>
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="bottom"
android:orientation="horizontal"
android:layout_margin="10dp">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
<Button
android:id="@+id/btn_signup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/btn_signup"
android:layout_weight="0.7"
android:background="@drawable/button_round"
android:textColor="@android:color/white"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>
</LinearLayout>
这是我想要的演示图片
请帮我解决一下
最佳答案
尝试下面的代码:
<?xml version="1.0" encoding="utf-8"?><?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="15dp"
android:orientation="vertical"
tools:context="com.angelnx.angelnx.holidays.Registration">
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<RelativeLayout
android:id="@+id/inner_relativelayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:id="@+id/inner_relativelayout2"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/symbol"
android:layout_width="fill_parent"
android:layout_height="170dp"
android:scaleType="fitXY"
android:src="@drawable/ic_menu_camera" />
</RelativeLayout>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/HomeFragmentProfileImageView"
android:layout_width="150dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="85dp"
android:src="@drawable/circularImage" />
<TextView
android:id="@+id/ProjectNameTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/HomeFragmentProfileImageView"
android:layout_centerHorizontal="true"
android:text="Profile"
android:textColor="#000000"
android:textSize="18sp"
android:textStyle="bold" />
</RelativeLayout>
<LinearLayout
android:id="@+id/viewB"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@color/fab_tint"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:contentDescription="@null"
android:src="@drawable/ic_username" />
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_name"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_name"
android:inputType="text"
android:paddingLeft="30dp"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:contentDescription="@null"
android:src="@drawable/ic_email" />
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_email"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_email"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_email"
android:inputType="textEmailAddress"
android:paddingLeft="30dp"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="start|center_vertical"
android:contentDescription="@null"
android:src="@drawable/lock_open" />
<android.support.design.widget.TextInputLayout
android:id="@+id/input_layout_password"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/input_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/hint_password"
android:inputType="textPassword"
android:paddingLeft="30dp"
android:singleLine="true" />
</android.support.design.widget.TextInputLayout>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:orientation="horizontal">
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@color/btn_start_color"
android:text="@string/btn_select"
android:textAllCaps="false"
android:textColor="@color/text_white"
android:textSize="17sp" />
</FrameLayout>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="10dp"
android:gravity="bottom"
android:orientation="horizontal">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
<Button
android:id="@+id/btn_signup"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0.7"
android:background="@drawable/button_round"
android:text="@string/btn_signup"
android:textColor="@android:color/white" />
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</ScrollView>
关于android - 如何在 android 布局的边框上设置我的 circleImageView?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37001170/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { profilephoto.setImageDrawable(
我在之前的项目中编写了几行代码,这些代码在单击个人资料图片时加载图库。我将代码从该项目复制粘贴到此处,进行了适当的更改,期望能够正常工作(因为它在其他应用程序上完美运行)。但我得到空指针异常。 Att
我创建了一个使用此 hdodenhof CircleImageview 库的应用程序。我的应用程序在 Android 7 和 7.1 上运行良好,但在较低版本(例如 marshmallow/Andro
我正在使用 this圆形图像的 repo ,它工作得很好。我遇到的问题是当我想使用不同尺寸的图像时,比如说一个非常大的正方形和一个小矩形。该库使用 scaleType = "CenterCrop"这适
我不知道如何描述这一点,但我附上了图片供您引用 问题是如何创建这个?或者您可以推荐的任何库。谢谢! 注意:我知道 CircularImageView。我要问的是该布局内的 ImageView 最佳答案
解释: 我想在我的布局边框上设置我的 circleImageView。 这是我的 xml 文件,其中有更多布局,但我想在布局的边框上设置 circleimageview。
美好的一天,我知道这个问题已经被问过。但根据搜索,他们的解决方案对于我这个主题都不起作用。我编译了 gradle - compile 'de.hdodenhof:circleimageview:1.3
我有一个水平的 RecyclerView,显示用于选择“配置文件”图像的图像。 我正在使用 CircleImageView 使图像带有圆角,这个库可以在每个图像上放置边框。 注意一个RecyclerV
所以我正在使用 Henning Dodenhof 的 CircleImageView。当我去膨胀包含此 CircleImageView 的 View 时: View row = inflator.i
我必须在应用程序中水平使用 java 代码动态显示一些图像。我可以使用简单的 ImageView 来做到这一点。但是使用 CircleImageView通过“hdodenhof”。我只能使用 XML
我有 ImageView。在 onPostExecute 中加载位图后,我调用 setImageDrawable 来用图像填充 imageView(我使用 CircleImageView)。但是 Tr
如何解决以下编译器错误: Error:(127) No resource identifier found for attribute 'border_width' in package 'talki
当我尝试使用:android.support.v4.widget.CircleImageView 它使我的应用程序崩溃 如何支持新的 Material Design Widget C
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.
此代码在 Android 中创建一个圆形图片: public class CircleImageView extends ImageView { private static final Sc
无法解决:de.hdodenhof:circleimageview:2.4.0 显示在文件中 在项目结构对话框中显示 最佳答案 dependencies的circleimageview是 2.2.0
尝试添加两个 Maven 存储库,但似乎无法解决此问题。 在 stackoverflow 上找不到任何信息,想知道在 Gradle 中解决依赖关系的标准方法是什么 根构建.gradle buildsc
我需要从网络获取的矩形/方形图像中获取圆形图像。在我的应用程序中,我使用 Volley 的 NetworkImageView 获取图像。我找到了很棒的图书馆 https://github.com/hd
这个问题已经有答案了: Picasso IllegalArgumentException Target must not be null (7 个回答) 已关闭 4 年前。 我正在尝试显示 Recyc
我开始将我的应用程序迁移到 Material Design,所以我将我的一个 ImageView 更改为 android.support.v4.widget.CircleImageView 并且应用程
我是一名优秀的程序员,十分优秀!