relativelayout

ConstraintLayout 所有属性

匿名 (未验证) 提交于 2019-12-03 00:25:02
1、基础值(以下是经常用到的值,很有规律) layout_constraintLeft_toLeftOf :当前View的右侧和另一个View的右侧位置对齐,与RelativeLayout的alignLeft属性相似 ***layout_constraintLeft_toRightOf ***:当前view的左侧会在另一个View的右侧位置 与RelativeLayout的toRightOf属性相似 layout_constraintRight_toLeftOf :当前view的右侧会在另一个View的左侧位置 与RelativeLayout的toLeftOf属性相似 layout_constraintRight_toRightOf :当前View的右侧和另一个View的右侧位置对其,与RelativeLayout的alignRight属性相似 layout_constraintTop_toTopOf :头部对齐,与alignTop相似 layout_constraintTop_toBottomOf :当前View在另一个View的下侧 与below相似 layout_constraintBottom_toTopOf :当前View在另一个View的上方 与above相似 layout_constraintBottom_toBottomOf :底部对齐

ImageView resizes when keyboard open

天大地大妈咪最大 提交于 2019-12-02 21:48:07
问题 This is my code <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/bgImage" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:contentDescription="@string/todo" android:scaleType="fitXY" android:src="@drawable/default_wallpaper" /> <LinearLayout android:id="@+id

Onlayout method on custom layout extending RelativeLayout

北城余情 提交于 2019-12-02 21:25:09
What is the proper way to override onLayout method in a custom layout extending the RelativeLayout? I'm trying to place all views in sort of a table. The idea is to fill one row with ImageViews until it's full and then continue in the new row. @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); int idOfViewToTheLeft = 1; RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(getContext(),); ImageView bookmark; for(int counter = 1; counter < getChildCount(); counter++) { bookmark = (ImageView) findViewById(counter);

Retrieve coordinates for ImageView

一曲冷凌霜 提交于 2019-12-02 18:42:51
问题 I would like to know if it is possible to get the coordinates, left and top, of an ImageView. I have 2 ImageView inside a RelativeLayout inside a ScrollView. I tried to retrieve the matrix of the ImageView with matrix = _iv.getImageMatrix(); but it is not helpful Matrix{[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]} . Any ideas? Would it make a difference if the getImageMatix() is run in a different place? 回答1: Here's a better way to do it. I implemented an OnTouchListener in the ImageView

Android 向右滑动销毁(finish)Activity, 随着手势的滑动而滑动的效果

不羁岁月 提交于 2019-12-02 12:20:39
转载请注明本文出自xiaanming的博客( http://blog.csdn.net/xiaanming/article/details/20934541 ),请尊重他人的辛勤劳动成果,谢谢! 今天给大家带来一个向右滑动销毁Activity的效果,Activtiy随着手指的移动而移动,该效果在Android应用中还是比较少见的,在IOS中就比较常见了,例如“网易新闻” ,"美食杰" , "淘宝"等应用采用此效果,而Android应用中“知乎”采用的也是这种滑动切换Activity的效果, 不过我发现“淘宝”并没有随着手势的移动而移动,只是捕捉到滑动手势,然后产生平滑切换界面的动画效果,这个在Android中还是很好实现的, 网上很多滑动切换Activity的Demo貌似都是这种效果的吧,如果要实现类似“网易新闻”的随手势的滑动而滑动,似乎就要复杂一些了,我之前在IOS中看到"网易新闻"的这种效果就很感兴趣,然后群里也有朋友问我怎么实现类似“知乎”这个应用的滑动切换的效果,我也特意去下了一个“知乎”,在之前的实现中我遇到了一些瓶颈,没有实现出来就搁置了在那里,今天无意中看到给Activity设置透明的背景,于是乎我恍然大悟,真是灵感来源于瞬间,不能强求啊,然后自己就将此效果实现了出来,给大家分享一下,希望给有此需求的你一点点帮助。

textView lines - advice

▼魔方 西西 提交于 2019-12-02 11:42:59
<RelativeLayout android:id="@+id/RelativeLayout1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" > <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:adjustViewBounds="true" android:src="@drawable/icon" /> <TextView android:id="@+id/fullnameTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/wayimageView" android:textColor="@color/list_text_color" android:textSize="16dp"

Unable to get proper custom AlertDialog

折月煮酒 提交于 2019-12-02 10:15:07
I have been trying to set a custom AlertDialog but was not able to get correctly. prompt.xml <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#ffe3e3" xmlns:tools="http://schemas.android.com/tools" tools:ignore="HardcodedText"> <TextView android:id="@+id/prompttitile" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_vertical|left" android:padding="5dp" android:text="Error Title Here" android

ImageView resizes when keyboard open

て烟熏妆下的殇ゞ 提交于 2019-12-02 09:27:51
This is my code <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="match_parent" > <ImageView android:id="@+id/bgImage" android:layout_width="fill_parent" android:layout_height="match_parent" android:layout_alignParentTop="true" android:contentDescription="@string/todo" android:scaleType="fitXY" android:src="@drawable/default_wallpaper" /> <LinearLayout android:id="@+id/mainLayout" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@

position view in relativelayout runtime

三世轮回 提交于 2019-12-02 05:36:11
i want to add a view to a relativelayout. this view must be added to a specified position. i have this: int x = ...; int y = ...; button.setOnTouchListener(new OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { int x = (int) event.getRawX(); int y = (int) event.getRawY(); v.layout(x, y, x + v.getWidth(), y + v.getHeight()); return true; } }); relativelayout.addView(button); button.layout(x, y, x + button.getWidth(), y + button.getHeight()); the ontouchlistener works great.. the view stays with my finger. however the startpostion is always 0, 0... it doesn't matter what my

android开发笔记

房东的猫 提交于 2019-12-02 05:00:44
1、android studio添加asset目录 项目切换到project模式,src->main目录右键,New->Folder->Assets Folder 2. android代码设置view背景色 view.setBackgroundColor(Color.parseColor("#FFFF3300")); //#FFFF3300其中前面2位FF是表示透明度,00为完全透明,FF为不透明,后面6位是颜色值 3. Manifest merger failed with multiple errors, see logs问题处理: 一直以为是manifest有错误,查看manifest代码没发现任何错误 android studio进入命令行,输入命令查看详细错误信息: gradlew processDebugManifest --stacktrace 发现详细错误:uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library 。是gradle文件minSdkVersion值和依赖库的版本值不一致,改成提示的最小值就解决了。 如果命令行也看不出错误信息,可以在android studio工具栏 build /ab按钮查看信息: 4. 打开页面报错:CLEARTEXT_NOT