I have one imageView and I am trying to give it minus margin top as much as its height / 2. I can do it at programmatically but i wondred is it possible at xml also andorid published percentrelative layout . I don't know how to to do it or possible?
is there possible to give marginTop as much as views height at xml?
95 Views Asked by Cihan Kaptan At
1
There are 1 best solutions below
Related Questions in ANDROID
- Delay in loading Html Page(WebView) from assets folder in real android device
- MPAndroidChart method setWordWrapEnabled() not found
- Designing a 'new post' android activity
- Android :EditText inside ListView always update first item in the listview
- Android: Transferring Data via ContentIntent
- Wrong xml being inflated android
- AsyncTask Class
- Unable to receive extras in Android Intent
- Website zoomed out on Android default browser
- Square FloatingActionButton with Android Design Library
- Google Maps API Re-size
- Push toolbar content below statusbar
- Android FragmentPagerAdapter Circular listview
- Layout not shifting up when keyboard is open
- auDIO_OUTPUT_FLAG_FAST denied by client can't connect to localhost
Related Questions in ANDROID-RELATIVELAYOUT
- Setting views dynamically with LayoutParams.addRule setting to the last position of the view
- Accessing Android Views in Java files
- ScrollView with RelativeLayout
- RelativeLayout programmatically margins not working
- scroll bar doesn't scroll to the last view
- Create RelativeView inside CardView programmatically android studio
- Error in Android RelativeLayout when wrapping_content
- Android onLongClick bug with TextView
- Relative Layout, align center of parent and right of view with no overlap
- Stuck with a Android layout
- RelativeLayout with background image scales incorrectly
- Layout occupies more than desired
- First time programmer confused as to why the EditText and Button fields aren't going where I want them to
- How to do RelativeLayout with images like gridview?
- Long Android TextView pushes other views off-screen
Related Questions in ANDROID-PERCENT-LIBRARY
- Percentage library not working properly
- is there possible to give marginTop as much as views height at xml?
- PercentFrameLayout: You must supply a layout_width attribute
- Can ConstraintLayout perform the same effect like PercentLayout?
- Switch element not centre aligning horizontally within allocated space
- Using PercentRelativeLayout specifying only width (heigh auto)
- Replacement for the linearLayout weights mechanism
- Android PercentRelativeLayout width and height should be specified
- Installation of the com:android:support:percent:22.2.1 library fails in Android Studio
- PercentRelativeLayout behaves differently on Android M
- Fix Layout issue
- PercentRelativeLayout, how to set the height programmatically
- Missing XML resource type for PercentRelativeLayout Percentage value?
- how to set ImageView width using Percent support lib and maintain aspect ratio?
- Android Animations on Percent Library
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
--Edit: As @aga suggests, there seems to be a way to achieve it via the Percent Support Library--
If you want to use this type of
imageViewmore often throughout your application you could extend imageview and put your margin-code inside of it's onMeasure:for this to work the view must be part of a ViewGroup.Also make sure you use the constructor with AttributeSet, oltherwise you can't create the View from xml. Yo then just include a CustomView in your layout xml, select
HalfMarginImageViewand use it as normal imageView.