android-framelayout

Android full screen camera - while keeping the camera selected ratio

眉间皱痕 提交于 2020-01-01 11:38:08
问题 We are trying to build something similar to Instagram Camera screen. i.e allow the user taking square photos. While doing it out U.i must be able to let the user see the camera on fullScreen mode. We want to force the user to take an image in a portrait mode Getting camera possible ratio's We are calculating the best ratio available from camera by private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) { final double ASPECT_TOLERANCE = 0.1; double targetRatio =

Android full screen camera - while keeping the camera selected ratio

白昼怎懂夜的黑 提交于 2020-01-01 11:37:07
问题 We are trying to build something similar to Instagram Camera screen. i.e allow the user taking square photos. While doing it out U.i must be able to let the user see the camera on fullScreen mode. We want to force the user to take an image in a portrait mode Getting camera possible ratio's We are calculating the best ratio available from camera by private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h) { final double ASPECT_TOLERANCE = 0.1; double targetRatio =

how to change the layout in frame layout on the click event?

老子叫甜甜 提交于 2019-12-31 05:33:10
问题 i have an layout consisting of two frame layout, my first Frame layout consist of the buttons,and another Frame layout is blank ,on click event on the button in first frame layout i wish to load the Activity layout in the second Frame layout? This is my XML LAYOUT <FrameLayout android:id="@+id/mainframelayout" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools

Called From Wrong Thread Exception

*爱你&永不变心* 提交于 2019-12-31 05:14:13
问题 I am getting an exception here when I try to bring another view to the front. It happens in the last method of my BoardView class where it says if(lives == 0). Can anybody see where I should be calling this bringToFront method from?? public class BoardView extends SurfaceView implements SurfaceHolder.Callback{ Context mContext; // thread initialization private BoardThread thread; Thread timer; // box variables Bitmap box = (BitmapFactory.decodeResource (getResources(), R.drawable.box));

Scale background image to wrap content of layout

只谈情不闲聊 提交于 2019-12-29 11:46:18
问题 I have a layout that contains some text fields and has a background image that's displayed at the top of my activity. I'd like the background image to scale to wrap the content (don't care about aspect ratio). However, the image is larger than content, so the layout instead wraps the background image. Here's my original code: <RelativeLayout android:layout_width="fill_parent" android:id="@+id/HeaderList" android:layout_gravity="top" android:layout_height="wrap_content" android:background="

Nullpointerexception thrown when trying to findViewById

ぐ巨炮叔叔 提交于 2019-12-28 07:16:24
问题 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

Android, java.lang.IllegalArgumentException: No view found for id [..] for fragment [..]

最后都变了- 提交于 2019-12-24 15:06:05
问题 I try to open a dialog in which I have a FrameLayout. While loading a fragment in the Layout I get this exception: java.lang.IllegalArgumentException: No view found for id 0x7f080044 (...id/selectionlayout) for fragment ScenesFragment{4166e8a0 #3 id=0x7f080044} I loaded the Parentlayout correctly and everything else seems correct as well. AlertDialog.Builder builder = new AlertDialog.Builder(main); // Get the layout inflater LayoutInflater inflater = main.getLayoutInflater(); final View v =

How should I add elements to a custom camera android application?

萝らか妹 提交于 2019-12-24 07:16:23
问题 my android app uses a custom camera. I just have a framelayout (full screen) in my xml layout file to which i programmatically add a surfaceview that contains the camera preview. Now I would like to add some buttons to my frame layout. I know that i could just add those buttons all programmatically, but is there a nicer way to do it. I mean, could I create something like a mask / layout that contains some buttons and that I then programmatically add to my frame layout? How do professional app

FrameLayout is shrinking ImageView , but camera is opening properly inside FrameLayout

谁都会走 提交于 2019-12-24 07:02:54
问题 I am opening the android Camera inside a FrameLayout in landscape mode, then the screen looks like- But the same Image when I open inside ImageView in FrameLayout, then it looks like- Please ignore the content of the Picture and funny squares drawn in the second image. The difference is, First CameraView opened in the entire screen or height touched the head of thescreen but second image shirinking the image to fit. I want the First image as well work like second, it should fit under a

How to draw the below image in android programatically?

十年热恋 提交于 2019-12-24 04:54:10
问题 I am new to android. I'm finding very difficulty in using the Canvas. How to draw the below image in android? I also want to make the alphabet selected highlighted when it is touched. 回答1: Here it is: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <FrameLayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="64dp" android:background="#000"> <!--