android-framelayout

Android child view height not match parent in ListView item

时光毁灭记忆、已成空白 提交于 2019-11-28 23:41:00
As described, my List item is a FrameLayout , there are two views inside. ColorView is a custom view I made for show color in whole view. ( FrameLayout 's height is "wrap_content") It seems work well on my ICS device, but doesn't work on my Android 2.2 emulator and Android 1.6 G1. <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content"> <org.mariotaku.twidere.view.ColorView android:id="@+id/status_background" android:layout_width="match_parent" android:layout_height=

FrameLayout vs RelativeLayout for overlays

大兔子大兔子 提交于 2019-11-28 19:28:47
问题 I need to implement an overlay (translucent) screen for my app, something similar to Showcase View My guess was to use FrameLayout for this usecase, because it is used to stack items on top of each other. But I was surprised to see that the above library uses RelativeLayout . My question is when to use FrameLayout then, if not in cases like this? What are the disadvantages if I go the FrameLayout way? 回答1: A common rule of thumb when choosing layouts is to select the combination that results

android:elevation only have shadow effects on the bottom side, how to make the shadow effects show on top side?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 18:15:50
I use a framelayout at the bottom of an activity, in order to show the shadow effects on the fragment, I add android:elevation. But the shadow effects only appear in the bottom side not on top side, any one could give me some advice? <FrameLayout android:id="@+id/bottom_container" android:background="#00737f" android:layout_width="match_parent" android:layout_height="50dp" android:layout_gravity="bottom" android:elevation="4dp" android:layout_alignParentBottom="true" android:layout_marginBottom="50dp"/> There is a trick that can be used to display a shadow above a View. Basically we have to

What does FrameLayout do?

冷暖自知 提交于 2019-11-28 16:48:13
I'm new to programming. I was using Graphical Layout then when I was reading xml file, I saw FrameLayout. Then I searched, but I couldn't find something useful. What is FrameLayout and what does it do? You use a FrameLayout to stack child views on top of each other, with the most recent child on top of the stack. In the example below, the TextView is the most recent, so it is automatically placed on top of the ImageView. For example: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android

IllegalStateException Fragment already added - Android

淺唱寂寞╮ 提交于 2019-11-28 14:36:19
I am adding fragment like bellow : @OnClick(R.id.lnNews) void newsList() { String tagName = returnStatusFragment(getString(R.string.news_list_fragment)); if (!TextUtils.isEmpty(tagName) && tagName.equals(getString(R.string.news_list_fragment))) { frameWorkTableFragment.setVisibility(View.VISIBLE); if (getActivity() != null) { android.support.v4.app.FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); Fragment news = fragmentManager.findFragmentByTag(getString(R.string.news_list_fragment)); getActivity().getSupportFragmentManager().beginTransaction() .replace(R.id.frame

requestWindowFeature(Window.FEATURE_NO_TITLE); causing the App to crash?

空扰寡人 提交于 2019-11-28 09:53:00
问题 The App crashs when I add this line `requestWindowFeature(Window.FEATURE_NO_TITLE); may be the solution is very simple, but i really dont know who to fix it. Java code: public class GLSurfaceCameraSurfaceDemo2Activity extends Activity { /** Called when the activity is first created. */ GLSurfaceView glSurfaceView; FrameLayout fl01; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); requestWindowFeature(Window.FEATURE

how to use correct dragging of a view on android

丶灬走出姿态 提交于 2019-11-28 08:49:41
it seems that there are a lot of solutions of how to use dragging of views on android . however, they are either too slow or buggy. a known solution is to have a framelayout , and the view simply changes its layoutParams as it moves using the OnTouchListener ,as described here: http://www.anddev.org/novice-tutorials-f8/android-drag-and-drop-of-normal-views-not-bitmaps-t13404.html however, if the view is an imageView , when reaching the most right (or most bottom) side of the framelayout , the image shrinks . another possible solution is to use the canvas in order to show the dragged content ,

change background image of Framelayout via URL

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 08:40:10
问题 is it possible to use a url to set background for framelayout ? Example: i want to use the URL like this as my framelayout background. what i really want to achieve is that when my activity loads it will fetch the image from my domain and use it as my framelayout background image. i was able to do this but i used a imageview and a button. below is the code that i use: public class MyAppActivity extends Activity { ImageView imView; String imageUrl= "http://www.mydomain.com/resource/images/";

Nullpointerexception thrown when trying to findViewById

别说谁变了你拦得住时间么 提交于 2019-11-28 02:24:44
I have the following Activity: public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new StartFragment()) .commit(); } Button login = (Button) findViewById(R.id.loginButton); login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { Intent intent = new Intent(MainActivity.this,LoginActivity.class); startActivity(intent

How to keep an image within layout with drag and drop

﹥>﹥吖頭↗ 提交于 2019-11-27 23:08:48
问题 I have the following XML: <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/palette2" android:id="@+id/fl" > <ImageView android:id="@+id/iv" android:layout_width="10dp" android:layout_height="10dp" android:src="@drawable/esquare" /> </FrameLayout> Which gives the following image in my Android Phone How can I code so that user can drag the image anywhere in a layout and the ImageView will always stay within the layout? If X<0 it